2 // Mono.ILASM.GlobalMethodRef
5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2003 Jackson Harper, All rights reserved
12 using System.Collections;
14 namespace Mono.ILASM {
16 public class GlobalMethodRef : BaseMethodRef {
18 public GlobalMethodRef (BaseTypeRef ret_type, PEAPI.CallConv call_conv,
19 string name, BaseTypeRef[] param, int gen_param_count)
20 : base (null, call_conv, ret_type, name, param, gen_param_count)
24 public override void Resolve (CodeGen code_gen)
29 if ((call_conv & PEAPI.CallConv.Vararg) == 0) {
30 string sig = MethodDef.CreateSignature (ret_type, call_conv, name, param, gen_param_count, false);
31 peapi_method = code_gen.ResolveMethod (sig);
33 ArrayList opt_list = new ArrayList ();
35 foreach (BaseTypeRef type in param) {
36 if (type is SentinelTypeRef) {
39 type.Resolve (code_gen);
40 opt_list.Add (type.PeapiType);
44 string sig_only_required_params = MethodDef.CreateSignature (ret_type, call_conv, name, param, gen_param_count, false);
45 string sig_with_optional_params = MethodDef.CreateSignature (ret_type, call_conv, name, param, gen_param_count, true);
46 peapi_method = code_gen.ResolveVarargMethod (sig_only_required_params, sig_with_optional_params, code_gen,
47 (PEAPI.Type[]) opt_list.ToArray (typeof (PEAPI.Type)));
50 peapi_method.AddCallConv (call_conv);