2 // Mono.ILASM.MethodRef
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 MethodRef : IMethodRef {
18 private TypeRef owner;
19 private PEAPI.CallConv call_conv;
20 private ITypeRef ret_type;
22 private ITypeRef[] param;
24 private PEAPI.Method peapi_method;
25 private bool is_resolved;
27 public MethodRef (TypeRef owner, PEAPI.CallConv call_conv,
28 ITypeRef ret_type, string name, ITypeRef[] param)
31 this.call_conv = call_conv;
32 this.ret_type = ret_type;
38 public PEAPI.Method PeapiMethod {
39 get { return peapi_method; }
42 public PEAPI.CallConv CallConv {
43 get { return call_conv; }
44 set { call_conv = value; }
47 public void Resolve (CodeGen code_gen)
52 TypeDef owner_def = code_gen.TypeManager[owner.FullName];
62 if ((call_conv & PEAPI.CallConv.Vararg) == 0) {
63 sig = MethodDef.CreateSignature (ret_type, name, param);
64 peapi_method = owner_def.ResolveMethod (sig, code_gen);
66 sig = MethodDef.CreateVarargSignature (ret_type, name, param);
67 ArrayList opt_list = new ArrayList ();
69 foreach (ITypeRef type in param) {
70 if (type is SentinelTypeRef) {
73 type.Resolve (code_gen);
74 opt_list.Add (type.PeapiType);
77 peapi_method = owner_def.ResolveVarargMethod (sig, code_gen,
78 (PEAPI.Type[]) opt_list.ToArray (typeof (PEAPI.Type)));