diff options
Diffstat (limited to 'mcs/ilasm/codegen/BaseClassRef.cs')
-rw-r--r-- | mcs/ilasm/codegen/BaseClassRef.cs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/mcs/ilasm/codegen/BaseClassRef.cs b/mcs/ilasm/codegen/BaseClassRef.cs new file mode 100644 index 00000000000..0be33e7be17 --- /dev/null +++ b/mcs/ilasm/codegen/BaseClassRef.cs @@ -0,0 +1,71 @@ +// +// Mono.ILASM.BaseClassRef +// +// Author(s): +// Ankit Jain <jankit@novell.com> +// +// Copyright 2006 Novell, Inc (http://www.novell.com) +// + +using System; +using System.Collections; + +namespace Mono.ILASM { + + public abstract class BaseClassRef : BaseTypeRef { + + protected Hashtable p_genericinst_table; + protected bool is_valuetype; + + protected BaseClassRef (string full_name, bool is_valuetype) + : this (full_name, is_valuetype, null, null) + { + } + + protected BaseClassRef (string full_name, bool is_valuetype, ArrayList conv_list, string sig_mod) + : base (full_name, conv_list, sig_mod) + { + this.is_valuetype = is_valuetype; + p_genericinst_table = null; + } + + public PEAPI.Class PeapiClass { + get { return type as PEAPI.Class; } + } + + public abstract BaseClassRef Clone (); + + public virtual void MakeValueClass () + { + is_valuetype = true; + } + + public virtual GenericTypeInst GetGenericTypeInst (GenericArguments gen_args) + { + return new GenericTypeInst (this, gen_args, is_valuetype); + } + + public virtual PEAPI.Type ResolveInstance (CodeGen code_gen, GenericArguments gen_args) + { + PEAPI.GenericTypeInst gtri = null; + string sig = gen_args.ToString (); + + if (p_genericinst_table == null) + p_genericinst_table = new Hashtable (); + else + gtri = p_genericinst_table [sig] as PEAPI.GenericTypeInst; + + if (gtri == null) { + if (!IsResolved) + Resolve (code_gen); + + gtri = new PEAPI.GenericTypeInst (PeapiType, gen_args.Resolve (code_gen)); + p_genericinst_table [sig] = gtri; + } + + return gtri; + } + } + + +} |