2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / ilasm / codegen / BaseMethodRef.cs
blob73c7b1e27409d877691cf64325f8a90c478b92b4
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 //
11 using System;
12 using System.Collections;
14 namespace Mono.ILASM {
15 public abstract class BaseMethodRef {
17 protected BaseTypeRef owner;
18 protected PEAPI.CallConv call_conv;
19 protected BaseTypeRef ret_type;
20 protected string name;
21 protected BaseTypeRef[] param;
23 protected PEAPI.Method peapi_method;
24 protected bool is_resolved;
25 protected int gen_param_count;
27 protected Hashtable gen_method_table;
29 public BaseMethodRef (BaseTypeRef owner, PEAPI.CallConv call_conv,
30 BaseTypeRef ret_type, string name, BaseTypeRef[] param, int gen_param_count)
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;
43 public virtual PEAPI.Method PeapiMethod {
44 get { return peapi_method; }
47 public virtual PEAPI.CallConv CallConv {
48 get { return call_conv; }
49 set { call_conv = value; }
52 public virtual BaseTypeRef Owner {
53 get { return owner; }
56 public abstract void Resolve (CodeGen code_gen);
58 public GenericMethodRef GetGenericMethodRef (GenericArguments gen_args)
60 GenericMethodRef methref = null;
62 if (gen_method_table == null)
63 gen_method_table = new Hashtable ();
64 else
65 methref = (GenericMethodRef) gen_method_table [gen_args.ToString ()];
67 if (methref == null) {
68 methref = new GenericMethodRef (this, GenericMethodSig.GetInstance (gen_args));
69 gen_method_table [gen_args.ToString ()] = methref;
72 return methref;