dlr bug
[mcs.git] / ilasm / codegen / BaseClassRef.cs
blobe59e3b8575e0704d53f2f010755842a6576447f4
1 //
2 // Mono.ILASM.BaseClassRef
3 //
4 // Author(s):
5 // Ankit Jain <jankit@novell.com>
6 //
7 // Copyright 2006 Novell, Inc (http://www.novell.com)
8 //
10 using System;
11 using System.Collections;
13 namespace Mono.ILASM {
15 public abstract class BaseClassRef : BaseTypeRef {
17 protected Hashtable p_genericinst_table;
18 protected bool is_valuetype;
20 protected BaseClassRef (string full_name, bool is_valuetype)
21 : this (full_name, is_valuetype, null, null)
25 protected BaseClassRef (string full_name, bool is_valuetype, ArrayList conv_list, string sig_mod)
26 : base (full_name, conv_list, sig_mod)
28 this.is_valuetype = is_valuetype;
29 p_genericinst_table = null;
32 public PEAPI.Class PeapiClass {
33 get { return type as PEAPI.Class; }
36 public virtual void MakeValueClass ()
38 is_valuetype = true;
41 public virtual GenericTypeInst GetGenericTypeInst (GenericArguments gen_args)
43 return new GenericTypeInst (this, gen_args, is_valuetype);
46 public virtual PEAPI.Type ResolveInstance (CodeGen code_gen, GenericArguments gen_args)
48 PEAPI.GenericTypeInst gtri = null;
49 string sig = gen_args.ToString ();
51 if (p_genericinst_table == null)
52 p_genericinst_table = new Hashtable ();
53 else
54 gtri = p_genericinst_table [sig] as PEAPI.GenericTypeInst;
56 if (gtri == null) {
57 if (!IsResolved)
58 Resolve (code_gen);
60 gtri = new PEAPI.GenericTypeInst (PeapiType, gen_args.Resolve (code_gen));
61 p_genericinst_table [sig] = gtri;
64 return gtri;