(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / ilasm / codegen / ExternTypeRef.cs
bloba697797121fd420aba49a005f9f9f907553e3a98
1 //
2 // Mono.ILASM.ExternTypeRef
3 //
4 // Author(s):
5 // Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
11 using System;
12 using System.Collections;
14 namespace Mono.ILASM {
16 /// <summary>
17 /// A reference to a type in another assembly
18 /// </summary>
19 public class ExternTypeRef : ModifiableType, IClassRef {
21 private PEAPI.Type type;
22 private ExternRef extern_ref;
23 private string full_name;
24 private string sig_mod;
25 private bool is_valuetype;
26 private ExternTable extern_table;
28 private bool is_resolved;
30 private Hashtable method_table;
31 private Hashtable field_table;
33 public ExternTypeRef (ExternRef extern_ref, string full_name,
34 bool is_valuetype, ExternTable extern_table)
36 this.extern_ref = extern_ref;
37 this.full_name = full_name;
38 this.is_valuetype = is_valuetype;
39 this.extern_table = extern_table;
40 sig_mod = String.Empty;
42 method_table = new Hashtable ();
43 field_table = new Hashtable ();
45 is_resolved = false;
48 private ExternTypeRef (ExternRef extern_ref, string full_name,
49 bool is_valuetype, ExternTable extern_table,
50 ArrayList conv_list) : this (extern_ref, full_name,
51 is_valuetype, extern_table)
53 ConversionList = conv_list;
56 public ExternTypeRef Clone ()
58 return new ExternTypeRef (extern_ref, FullName, is_valuetype,
59 extern_table, (ArrayList) ConversionList.Clone ());
62 public PEAPI.Type PeapiType {
63 get { return type; }
66 public PEAPI.Class PeapiClass {
67 get { return type as PEAPI.Class; }
70 public string FullName {
71 get { return full_name + sig_mod; }
75 public override string SigMod {
76 get { return sig_mod; }
77 set { sig_mod = value; }
80 public void Resolve (CodeGen code_gen)
82 if (is_resolved)
83 return;
85 if (is_valuetype)
86 type = extern_ref.GetValueType (full_name);
87 else
88 type = extern_ref.GetType (full_name);
90 type = Modify (code_gen, type);
92 is_resolved = true;
95 public void MakeValueClass ()
97 is_valuetype = true;
100 public IMethodRef GetMethodRef (ITypeRef ret_type, PEAPI.CallConv call_conv,
101 string name, ITypeRef[] param)
103 string sig = MethodDef.CreateSignature (name, param);
104 ExternMethodRef mr = method_table [sig] as ExternMethodRef;
106 if (mr == null) {
107 mr = new ExternMethodRef (this, ret_type, call_conv, name, param);
108 method_table [sig] = mr;
111 return mr;
114 public IFieldRef GetFieldRef (ITypeRef ret_type, string name)
116 ExternFieldRef fr = field_table [name] as ExternFieldRef;
118 if (fr == null) {
119 fr = new ExternFieldRef (this, ret_type, name);
120 field_table [name] = fr;
123 return fr;