(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / ilasm / codegen / PrimitiveTypeRef.cs
blobecfb9a9866c0d735c0d254d40c93d9864e073ae9
1 //
2 // Mono.ILASM.PrimitiveTypeRef
3 //
4 // Author(s):
5 // Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
11 using System;
13 namespace Mono.ILASM {
15 /// <summary>
16 /// Reference to a primitive type, ie string, object, char
17 /// </summary>
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)
28 this.type = type;
29 this.full_name = full_name;
30 sig_mod = String.Empty;
31 is_resolved = false;
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 {
44 get { return type; }
47 public void Resolve (CodeGen code_gen)
49 if (is_resolved)
50 return;
52 // Perform all of the types modifications
53 type = Modify (code_gen, type);
55 is_resolved = true;
58 /// <summary>
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.
63 /// </summary>
64 public static PrimitiveTypeRef GetPrimitiveType (string full_name)
66 switch (full_name) {
67 case "System.String":
68 return new PrimitiveTypeRef (PEAPI.PrimitiveType.String, full_name);
69 case "System.Object":
70 return new PrimitiveTypeRef (PEAPI.PrimitiveType.Object, full_name);
71 default:
72 return null;
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)
94 if (IsArray)
95 type_ref.MakeArray ();
97 return type_ref;
99 throw new NotImplementedException ("This method is getting depricated.");