2 // Mono.ILASM.GenericParamRef
5 // Jackson Harper (Jackson@LatitudeGeo.com)
6 // Ankit Jain (JAnkit@novell.com)
8 // (C) 2003 Jackson Harper, All rights reserved
9 // (C) 2006 Novell, Inc (http://www.novell.com)
14 using System.Collections;
16 namespace Mono.ILASM {
18 public interface IGenericTypeRef : IClassRef {
19 /* Used to resolve any gen params in arguments, constraints etc */
20 void Resolve (GenericParameters type_gen_params, GenericParameters method_gen_params);
22 /* Only resolves, does not add it to the TypeSpec
24 void ResolveNoTypeSpec (CodeGen code_gen);
27 public class GenericParamRef : ModifiableType, IGenericTypeRef {
29 /* Might get modified */
30 private PEAPI.Type type;
31 /* Unmodified GenParam */
32 private PEAPI.GenParam param;
33 private string full_name;
34 private string sig_mod;
35 private bool is_resolved;
36 private bool is_added; /* Added to TypeSpec table ? */
38 public GenericParamRef (PEAPI.GenParam gen_param, string full_name)
39 : this (gen_param, full_name, null)
43 public GenericParamRef (PEAPI.GenParam gen_param, string full_name, ArrayList conv_list)
45 this.type = gen_param;
46 this.param = gen_param;
47 this.full_name = full_name;
48 sig_mod = String.Empty;
51 if (conv_list != null)
52 ConversionList = conv_list;
55 public string FullName {
57 return (param.Type == PEAPI.GenParamType.Var ? "!" : "!!")
58 + param.Index + sig_mod;
62 public override string SigMod {
63 get { return sig_mod; }
64 set { sig_mod = value; }
67 public PEAPI.Type PeapiType {
71 public PEAPI.Class PeapiClass {
72 get { return (PEAPI.Class) type; }
75 public void MakeValueClass ()
77 throw new Exception ("Not supported");
80 public IClassRef Clone ()
82 return new GenericParamRef (param, full_name, (ArrayList) ConversionList.Clone ());
85 public GenericTypeInst GetGenericTypeInst (GenericArguments gen_args)
87 throw new Exception ("Not supported");
90 public PEAPI.Type ResolveInstance (CodeGen code_gen, GenericArguments gen_args)
92 throw new Exception ("Not supported");
95 public void ResolveNoTypeSpec (CodeGen code_gen)
100 type = Modify (code_gen, type);
104 public void Resolve (CodeGen code_gen)
106 ResolveNoTypeSpec (code_gen);
110 code_gen.PEFile.AddGenericParam (param);
114 public void Resolve (GenericParameters type_gen_params, GenericParameters method_gen_params)
116 throw new Exception ("Not implemented yet");
119 public IMethodRef GetMethodRef (ITypeRef ret_type, PEAPI.CallConv call_conv,
120 string name, ITypeRef[] param, int gen_param_count)
122 return new TypeSpecMethodRef (this, ret_type, call_conv, name, param, gen_param_count);
125 public IFieldRef GetFieldRef (ITypeRef ret_type, string name)
127 return new TypeSpecFieldRef (this, ret_type, name);