2 // Mono.ILASM.ExternTypeRefInst
5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2004 Novell, Inc (http://www.novell.com)
12 using System
.Collections
;
14 namespace Mono
.ILASM
{
16 public class ExternTypeRefInst
: BaseTypeRef
{
18 private ExternTypeRef type_ref
;
19 private PEAPI
.Type type
;
20 private bool is_valuetypeinst
;
21 private bool is_resolved
;
22 private GenericArguments gen_args
;
23 private static Hashtable method_table
= new Hashtable ();
25 public ExternTypeRefInst (ExternTypeRef type_ref
, GenericArguments gen_args
, bool is_valuetypeinst
)
27 this.type_ref
= type_ref
;
28 this.gen_args
= gen_args
;
29 this.is_valuetypeinst
= is_valuetypeinst
;
34 public PEAPI
.Type PeapiType
{
38 public string FullName
{
39 get { return type_ref.FullName; }
43 public string SigMod
{
44 get { return type_ref.SigMod; }
45 set { type_ref.SigMod = value; }
49 public bool IsPinned
{
50 get { return type_ref.IsPinned; }
54 get { return type_ref.IsRef; }
58 get { return type_ref.IsArray; }
61 public bool UseTypeSpec
{
62 get { return type_ref.UseTypeSpec; }
65 public ExternTypeRefInst
Clone ()
67 return new ExternTypeRefInst (type_ref
.Clone (), gen_args
, is_valuetypeinst
);
70 public void MakeArray ()
72 is_valuetypeinst
= false;
73 type_ref
.MakeArray ();
76 public void MakeBoundArray (ArrayList bounds
)
78 is_valuetypeinst
= false;
79 type_ref
.MakeBoundArray (bounds
);
82 public void MakeManagedPointer ()
84 type_ref
.MakeManagedPointer ();
87 public void MakeUnmanagedPointer ()
89 type_ref
.MakeUnmanagedPointer ();
92 public void MakeCustomModified (CodeGen code_gen
,
93 PEAPI
.CustomModifier modifier
, BaseClassRef klass
)
95 type_ref
.MakeCustomModified (code_gen
, modifier
, klass
);
98 public void MakePinned ()
100 type_ref
.MakePinned ();
103 public void MakeValueClass ()
105 type_ref
.MakeValueClass ();
108 public void Resolve (CodeGen code_gen
)
113 type_ref
.Resolve (code_gen
);
115 type
= new PEAPI
.GenericTypeInst (type_ref
.PeapiType
, gen_args
.Resolve (code_gen
));
120 public BaseMethodRef
GetMethodRef (BaseTypeRef ret_type
, PEAPI
.CallConv call_conv
,
121 string name
, BaseTypeRef
[] param
, int gen_param_count
)
123 string key
= type_ref
.FullName
+ MethodDef
.CreateSignature (ret_type
, name
, param
, gen_param_count
) + type_ref
.SigMod
;
124 TypeSpecMethodRef mr
= method_table
[key
] as TypeSpecMethodRef
;
126 mr
= new TypeSpecMethodRef (this, ret_type
, call_conv
, name
, param
, gen_param_count
);
127 method_table
[key
] = mr
;
133 public IFieldRef
GetFieldRef (BaseTypeRef ret_type
, string name
)
135 return new TypeSpecFieldRef (this, ret_type
, name
);