2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / ilasm / codegen / TypeManager.cs
blob029b31446329f8d6d68f9b5911733148ccc575dd
1 //
2 // Mono.ILASM.TypeManager.cs
3 //
4 // Author(s):
5 // Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
10 using System;
11 using System.Collections;
13 namespace Mono.ILASM {
15 public class TypeManager {
17 private Hashtable type_table;
18 private CodeGen code_gen;
20 public TypeManager (CodeGen code_gen)
22 this.code_gen = code_gen;
23 type_table = new Hashtable ();
26 public TypeDef this[string full_name] {
27 get {
28 return (TypeDef) type_table[full_name];
30 set {
31 type_table[full_name] = value;
35 public PEAPI.Type GetPeapiType (string full_name)
37 TypeDef type_def = (TypeDef) type_table[full_name];
39 if (type_def == null)
40 return null;
42 if (!type_def.IsDefined)
43 type_def.Define (code_gen);
45 return type_def.PeapiType;
48 public void DefineAll ()
50 ArrayList type_list = new ArrayList (type_table.Values);
51 type_list.Sort ();
52 foreach (TypeDef typedef in type_list) {
53 typedef.Define (code_gen);