New test.
[mono.git] / mcs / ilasm / codegen / TypeSpecMethodRef.cs
1 //
2 // Mono.ILASM.TypeSpecMethodRef
3 //
4 // Author(s):
5 //  Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
9
10
11 using System;
12
13
14 namespace Mono.ILASM {
15
16         public class TypeSpecMethodRef : BaseMethodRef {
17
18                 public TypeSpecMethodRef (BaseTypeRef owner,
19                                 PEAPI.CallConv call_conv, BaseTypeRef ret_type,
20                                 string name, BaseTypeRef[] param, int gen_param_count)
21                         : base (owner, call_conv, ret_type, name, param, gen_param_count)
22                 {
23                 }
24
25                 public override void Resolve (CodeGen code_gen)
26                 {
27                         if (is_resolved)
28                                 return;
29
30                         PEAPI.Type[] param_list = new PEAPI.Type[param.Length];
31                         string write_name;
32
33                         ret_type.Resolve (code_gen);
34
35                         int count = 0;
36                         foreach (BaseTypeRef typeref in param) {
37                                 typeref.Resolve (code_gen);
38                                 param_list[count++] = typeref.PeapiType;
39                         }
40
41                         if (name == "<init>")
42                                 write_name = ".ctor";
43                         else
44                                 write_name = name;
45
46                         owner.Resolve (code_gen);
47                         peapi_method = code_gen.PEFile.AddMethodToTypeSpec (owner.PeapiType, write_name,
48                                         ret_type.PeapiType, param_list, gen_param_count);
49
50                         peapi_method.AddCallConv (call_conv);
51
52                         is_resolved = true;
53                 }
54         }
55
56 }
57
58
59