2 // Mono.ILASM.TypeSpecMethodRef
5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2003 Jackson Harper, All rights reserved
14 namespace Mono.ILASM {
16 public class TypeSpecMethodRef : IMethodRef {
18 private PEAPI.MethodRef peapi_method;
19 private ITypeRef owner;
21 private PEAPI.CallConv call_conv;
22 private ITypeRef ret_type;
24 private ITypeRef[] param;
25 private int gen_param_count;
27 private bool is_resolved;
29 public TypeSpecMethodRef (ITypeRef owner,
30 ITypeRef ret_type, PEAPI.CallConv call_conv,
31 string name, ITypeRef[] param, int gen_param_count)
34 this.call_conv = call_conv;
35 this.ret_type = ret_type;
38 this.gen_param_count = gen_param_count;
39 if (gen_param_count > 0)
40 CallConv |= PEAPI.CallConv.Generic;
44 public PEAPI.Method PeapiMethod {
50 public PEAPI.CallConv CallConv {
51 get { return call_conv; }
52 set { call_conv = value; }
55 public ITypeRef Owner {
59 public void Resolve (CodeGen code_gen)
64 PEAPI.Type[] param_list = new PEAPI.Type[param.Length];
67 ret_type.Resolve (code_gen);
70 foreach (ITypeRef typeref in param) {
71 typeref.Resolve (code_gen);
72 param_list[count++] = typeref.PeapiType;
80 owner.Resolve (code_gen);
81 peapi_method = code_gen.PEFile.AddMethodToTypeSpec (owner.PeapiType, write_name,
82 ret_type.PeapiType, param_list, gen_param_count);
84 peapi_method.AddCallConv (call_conv);