1 // 2 // Mono.ILASM.BaseMethodRef 3 // 4 // Author(s): 5 // Ankit Jain <JAnkit@novell.com> 6 // 7 // Copyright 2006 Novell, Inc (http://www.novell.com) 8 // 9 10 11 using System; 12 using System.Collections; 13 14 namespace Mono.ILASM { 15 public abstract class BaseMethodRef { 16 17 protected BaseTypeRef owner; 18 protected PEAPI.CallConv call_conv; 19 protected BaseTypeRef ret_type; 20 protected string name; 21 protected BaseTypeRef[] param; 22 23 protected PEAPI.Method peapi_method; 24 protected bool is_resolved; 25 protected int gen_param_count; 26 27 protected Hashtable gen_method_table; 28 BaseMethodRef(BaseTypeRef owner, PEAPI.CallConv call_conv, BaseTypeRef ret_type, string name, BaseTypeRef[] param, int gen_param_count)29 public BaseMethodRef (BaseTypeRef owner, PEAPI.CallConv call_conv, 30 BaseTypeRef ret_type, string name, BaseTypeRef[] param, int gen_param_count) 31 { 32 this.owner = owner; 33 this.call_conv = call_conv; 34 this.ret_type = ret_type; 35 this.name = name; 36 this.param = param; 37 this.gen_param_count = gen_param_count; 38 if (gen_param_count > 0) 39 CallConv |= PEAPI.CallConv.Generic; 40 is_resolved = false; 41 } 42 43 public virtual PEAPI.Method PeapiMethod { 44 get { return peapi_method; } 45 } 46 47 public virtual PEAPI.CallConv CallConv { 48 get { return call_conv; } 49 set { call_conv = value; } 50 } 51 52 public virtual BaseTypeRef Owner { 53 get { return owner; } 54 } 55 Resolve(CodeGen code_gen)56 public abstract void Resolve (CodeGen code_gen); 57 GetGenericMethodRef(GenericArguments gen_args)58 public GenericMethodRef GetGenericMethodRef (GenericArguments gen_args) 59 { 60 GenericMethodRef methref = null; 61 62 if (gen_method_table == null) 63 gen_method_table = new Hashtable (); 64 else 65 methref = (GenericMethodRef) gen_method_table [gen_args.ToString ()]; 66 67 if (methref == null) { 68 methref = new GenericMethodRef (this, GenericMethodSig.GetInstance (gen_args)); 69 gen_method_table [gen_args.ToString ()] = methref; 70 } 71 72 return methref; 73 } 74 75 } 76 } 77 78 79 80