Rename gtest-235-exe.cs to gtest-235.cs
[mono.git] / mcs / ilasm / codegen / TypeRef.cs
1 //
2 // Mono.ILASM.TypeRef
3 //
4 // Author(s):
5 //  Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
9
10 using System;
11 using System.Collections;
12
13 namespace Mono.ILASM {
14
15         /// <summary>
16         /// Reference to a type in the module being compiled.
17         /// </summary>
18         public class TypeRef : BaseClassRef {
19
20                 private Location location;
21                 public static readonly TypeRef Ellipsis = new TypeRef ("ELLIPSIS", false, null);
22                 public static readonly TypeRef Any = new TypeRef ("any", false, null);
23
24                 public TypeRef (string full_name, bool is_valuetype, Location location)
25                         : this (full_name, is_valuetype, location, null, null)
26                 {
27                 }
28
29                 public TypeRef (string full_name, bool is_valuetype, Location location, ArrayList conv_list, string sig_mod)
30                         : base (full_name, is_valuetype, conv_list, sig_mod)
31                 {
32                         this.location = location;
33                 }
34                 
35                 public override BaseClassRef Clone ()
36                 {
37                         return new TypeRef (full_name, is_valuetype, location, (ArrayList) ConversionList.Clone (), sig_mod);
38                 }
39
40                 protected override BaseMethodRef CreateMethodRef (BaseTypeRef ret_type,
41                         PEAPI.CallConv call_conv, string name, BaseTypeRef[] param, int gen_param_count)
42                 {
43                          return new MethodRef (this, call_conv, ret_type, name, param, gen_param_count);
44                 }
45
46                 protected override IFieldRef CreateFieldRef (BaseTypeRef ret_type, string name)
47                 {
48                          return new FieldRef (this, ret_type, name);
49                 }
50
51                 public override void Resolve (CodeGen code_gen)
52                 {
53                         if (is_resolved)
54                                 return;
55
56                         PEAPI.Type base_type;
57
58                         base_type = code_gen.TypeManager.GetPeapiType (full_name);
59
60                         if (base_type == null) {
61                                 code_gen.Report.Error ("Reference to undefined class '" +
62                                                        FullName + "'");
63                                 return;
64                         }
65                         type = Modify (code_gen, base_type);
66
67                         is_resolved = true;
68                 }
69
70                 public BaseClassRef AsClassRef (CodeGen code_gen)
71                 {
72                         return this;
73                 }
74
75                 public override string ToString ()
76                 {
77                         return FullName;
78                 }
79
80         }
81
82 }
83