2 // Mono.ILASM.PrimitiveTypeRef
5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2003 Jackson Harper, All rights reserved
13 namespace Mono
.ILASM
{
16 /// Reference to a primitive type, ie string, object, char
18 public class PrimitiveTypeRef
: ModifiableType
, ITypeRef
{
20 private string full_name
;
21 private string sig_mod
;
22 private PEAPI
.Type type
;
24 private bool is_resolved
;
26 public PrimitiveTypeRef (PEAPI
.PrimitiveType type
, string full_name
)
29 this.full_name
= full_name
;
30 sig_mod
= String
.Empty
;
34 public string FullName
{
35 get { return full_name + sig_mod; }
38 public override string SigMod
{
39 get { return sig_mod; }
40 set { sig_mod = value; }
43 public PEAPI
.Type PeapiType
{
47 public void Resolve (CodeGen code_gen
)
52 // Perform all of the types modifications
53 type
= Modify (code_gen
, type
);
59 /// Primitive types can be created like this System.String instead
60 /// of like a normal type that would be [mscorlib]System.String This
61 /// method returns a proper primitive type if the supplied name is
62 /// the name of a primitive type.
64 public static PrimitiveTypeRef
GetPrimitiveType (string full_name
)
68 return new PrimitiveTypeRef (PEAPI
.PrimitiveType
.String
, full_name
);
70 return new PrimitiveTypeRef (PEAPI
.PrimitiveType
.Object
, full_name
);
76 public IMethodRef
GetMethodRef (ITypeRef ret_type
, PEAPI
.CallConv call_conv
,
77 string name
, ITypeRef
[] param
)
79 return new TypeSpecMethodRef (this, ret_type
, call_conv
, name
, param
);
82 public IFieldRef
GetFieldRef (ITypeRef ret_type
, string name
)
84 return new TypeSpecFieldRef (this, ret_type
, name
);
87 public IClassRef
AsClassRef (CodeGen code_gen
)
90 PEAPI.ClassRef class_ref = code_gen.ExternTable.GetValueClass ("corlib", FullName);
91 ExternTypeRef type_ref = new ExternTypeRef (class_ref, FullName);
93 // TODO: Need to do the rest of the conversion (in order)
95 type_ref.MakeArray ();
99 throw new NotImplementedException ("This method is getting depricated.");