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 : IMethodRef {
18 private ITypeRef ret_type;
20 private ITypeRef[] param;
21 private PEAPI.CallConv call_conv;
23 private PEAPI.Method peapi_method;
25 public GlobalMethodRef (ITypeRef ret_type, PEAPI.CallConv call_conv,
26 string name, ITypeRef[] param)
28 this.ret_type = ret_type;
29 this.call_conv = call_conv;
34 public PEAPI.Method PeapiMethod {
35 get { return peapi_method; }
38 public void Resolve (CodeGen code_gen)
40 string sig = MethodDef.CreateSignature (name, param);
42 if ((call_conv & PEAPI.CallConv.Vararg) == 0) {
43 peapi_method = code_gen.ResolveMethod (sig);
45 ArrayList opt_list = new ArrayList ();
47 foreach (ITypeRef type in param) {
48 if (TypeRef.Ellipsis == type) {
51 type.Resolve (code_gen);
52 opt_list.Add (type.PeapiType);
55 peapi_method = code_gen.ResolveVarargMethod (sig, code_gen,
56 (PEAPI.Type[]) opt_list.ToArray (typeof (PEAPI.Type)));
59 peapi_method.AddCallConv (call_conv);