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 PEAPI.Type type;
23 private bool is_resolved;
25 public PrimitiveTypeRef (PEAPI.PrimitiveType type, string full_name)
28 this.full_name = full_name;
33 public string FullName {
34 get { return full_name; }
37 public PEAPI.Type PeapiType {
41 public void Resolve (CodeGen code_gen)
46 // Perform all of the types modifications
47 type = Modify (code_gen, type, ref full_name);
53 /// Primitive types can be created like this System.String instead
54 /// of like a normal type that would be [mscorlib]System.String This
55 /// method returns a proper primitive type if the supplied name is
56 /// the name of a primitive type.
58 public static PrimitiveTypeRef GetPrimitiveType (string full_name)
62 return new PrimitiveTypeRef (PEAPI.PrimitiveType.String, full_name);
64 return new PrimitiveTypeRef (PEAPI.PrimitiveType.Object, full_name);
70 public IMethodRef GetMethodRef (ITypeRef ret_type, PEAPI.CallConv call_conv,
71 string name, ITypeRef[] param)
73 return new TypeSpecMethodRef (this, ret_type, call_conv, name, param);
76 public IFieldRef GetFieldRef (ITypeRef ret_type, string name)
78 return new TypeSpecFieldRef (this, ret_type, name);
81 public IClassRef AsClassRef (CodeGen code_gen)
84 PEAPI.ClassRef class_ref = code_gen.ExternTable.GetValueClass ("corlib", FullName);
85 ExternTypeRef type_ref = new ExternTypeRef (class_ref, FullName);
87 // TODO: Need to do the rest of the conversion (in order)
89 type_ref.MakeArray ();
93 throw new NotImplementedException ("This method is getting depricated.");