**** Merged from MCS ****
[mono-project.git] / mcs / ilasm / codegen / ExternTypeRefInst.cs
blob1c501920441b0fee756cf147a34f7e1f532ca335
1 //
2 // Mono.ILASM.ExternTypeRefInst
3 //
4 // Author(s):
5 // Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2004 Novell, Inc (http://www.novell.com)
8 //
11 using System;
12 using System.Collections;
14 namespace Mono.ILASM {
16 public class ExternTypeRefInst : ITypeRef {
18 private ExternTypeRef type_ref;
19 private PEAPI.Type type;
20 private bool is_valuetypeinst;
21 private bool is_resolved;
23 public ExternTypeRefInst (ExternTypeRef type_ref, bool is_valuetypeinst)
25 this.type_ref = type_ref;
26 this.is_valuetypeinst = is_valuetypeinst;
28 is_resolved = false;
31 public PEAPI.Type PeapiType {
32 get { return type; }
35 public string FullName {
36 get { return type_ref.FullName; }
40 public string SigMod {
41 get { return type_ref.SigMod; }
42 set { type_ref.SigMod = value; }
46 public bool IsPinned {
47 get { return type_ref.IsPinned; }
50 public bool IsRef {
51 get { return type_ref.IsRef; }
54 public bool IsArray {
55 get { return type_ref.IsArray; }
58 public bool UseTypeSpec {
59 get { return type_ref.UseTypeSpec; }
62 public ExternTypeRefInst Clone ()
64 return new ExternTypeRefInst (type_ref.Clone (), is_valuetypeinst);
67 public void MakeArray ()
69 type_ref.MakeArray ();
72 public void MakeBoundArray (ArrayList bounds)
74 type_ref.MakeBoundArray (bounds);
77 public void MakeManagedPointer ()
79 type_ref.MakeManagedPointer ();
82 public void MakeUnmanagedPointer ()
84 type_ref.MakeUnmanagedPointer ();
87 public void MakeCustomModified (CodeGen code_gen,
88 PEAPI.CustomModifier modifier, IClassRef klass)
90 type_ref.MakeCustomModified (code_gen, modifier, klass);
93 public void MakePinned ()
95 type_ref.MakePinned ();
98 public void MakeValueClass ()
100 type_ref.MakeValueClass ();
103 public void Resolve (CodeGen code_gen)
105 if (is_resolved)
106 return;
108 type_ref.Resolve (code_gen);
109 type = new PEAPI.ClassRefInst (type_ref.PeapiType, is_valuetypeinst);
111 is_resolved = true;
114 public IMethodRef GetMethodRef (ITypeRef ret_type, PEAPI.CallConv call_conv,
115 string name, ITypeRef[] param)
117 return new TypeSpecMethodRef (this, ret_type, call_conv, name, param);
120 public IFieldRef GetFieldRef (ITypeRef ret_type, string name)
122 return new TypeSpecFieldRef (this, ret_type, name);