(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / ilasm / codegen / Types.cs
bloba4f930991f16cb590b8263ba835d27702d132d3d
1 // Types.cs
2 // (C) Sergey Chaban (serge@wildwestsoftware.com)
4 using System;
5 using System.Collections;
6 using System.Reflection;
8 namespace Mono.ILASM {
10 public class Types {
12 // maps default types to their library equivalents
13 private static Hashtable defaultTypes;
14 private static readonly object dummy;
15 private Hashtable userTypes;
17 static Types ()
19 dummy = new Object ();
21 defaultTypes = new Hashtable ();
22 Hashtable t = defaultTypes;
24 t ["object"] = Type.GetType ("System.Object");
25 t ["string"] = Type.GetType ("System.String");
26 t ["char"] = Type.GetType ("System.Char");
27 t ["void"] = Type.GetType ("System.Void");
28 t ["bool"] = Type.GetType ("System.Boolean");
29 t ["int8"] = Type.GetType ("System.Byte");
30 t ["int16"] = Type.GetType ("System.Int16");
31 t ["int32"] = Type.GetType ("System.Int32");
32 t ["int64"] = Type.GetType ("System.Int64");
33 t ["float32"] = Type.GetType ("System.Single");
34 t ["float64"] = Type.GetType ("System.Double");
35 t ["uint8"] = Type.GetType ("System.SByte");
36 t ["uint16"] = Type.GetType ("System.UInt16");
37 t ["uint32"] = Type.GetType ("System.UInt32");
38 t ["uint64"] = Type.GetType ("System.UInt64");
42 /// <summary>
43 /// </summary>
44 public Types ()
49 /// <summary>
50 /// </summary>
51 /// <param name="typeName"></param>
52 /// <returns></returns>
53 public Type Lookup (string typeName)
55 Type res = defaultTypes [typeName] as Type;
56 return res;
60 /// <summary>
61 /// </summary>
62 /// <param name="name"></param>
63 /// <param name="type"></param>
64 public void Add (string name, Type type)
66 if (defaultTypes.Contains (name)) return;
68 if (userTypes == null) userTypes = new Hashtable ();
69 userTypes [name] = (type != null) ? type : dummy;
73 /// <summary>
74 /// </summary>
75 /// <param name="name"></param>
76 public void Add (string name){
77 Add (name, null);