Explorar el Código

GenericTypeInst.Resolve should do the expected thing ie., resolve and add
the Generic Inst to the typespec table. Use ResolveOnly to Resolve w/o
adding to the table.
* GenericTypeInst.cs (GenericTypeInst.Resolve): Rename to ..
(GenericTypeInst.ResolveOnly): .. this.
(GenericTypeInst.ResolveAsClass): Rename to Resolve.

* TypeDef.cs (TypeDef.Define): Revert the ResolveAsClass calls added here.
* Local.cs (Local.GetPeapiLocal): Use new GenericTypeInst.ResolveOnly if type is
GenericTypeInst.

svn path=/trunk/mcs/; revision=55144

Ankit Jain hace 20 años
padre
commit
5d8e0ff8d2

+ 13 - 0
mcs/ilasm/codegen/ChangeLog

@@ -1,3 +1,16 @@
+2006-01-06  Ankit Jain  <[email protected]>
+
+	GenericTypeInst.Resolve should do the expected thing ie., resolve and add
+	the Generic Inst to the typespec table. Use ResolveOnly to Resolve w/o 
+	adding to the table.
+	* GenericTypeInst.cs (GenericTypeInst.Resolve): Rename to ..
+	(GenericTypeInst.ResolveOnly): .. this.
+	(GenericTypeInst.ResolveAsClass): Rename to Resolve.
+
+	* TypeDef.cs (TypeDef.Define): Revert the ResolveAsClass calls added here.
+	* Local.cs (Local.GetPeapiLocal): Use new GenericTypeInst.ResolveOnly if type is
+	GenericTypeInst.
+
 2006-01-06  Ankit Jain  <[email protected]>
 
 	* IClassRef.cs (IClassRef.Clone): New.

+ 9 - 14
mcs/ilasm/codegen/GenericTypeInst.cs

@@ -19,6 +19,7 @@ namespace Mono.ILASM {
 
                 private IClassRef class_ref;
                 private PEAPI.Type ptype;
+                private PEAPI.GenericTypeInst p_gen_inst;
                 private bool is_valuetypeinst;
                 private bool is_resolved;
                 private GenericArguments gen_args;
@@ -88,34 +89,28 @@ namespace Mono.ILASM {
                         throw new Exception (String.Format ("Invalid attempt to create '{0}''{1}'", FullName, gen_args.ToString ()));
                 }
                 
-                public void Resolve (CodeGen code_gen)
+                /* Only resolves, does not add it to the TypeSpec
+                   table */
+                public void ResolveOnly (CodeGen code_gen)
                 {
                         if (is_resolved)
                                 return;
 
                         class_ref.Resolve (code_gen);
-                        ptype = class_ref.ResolveInstance (code_gen, gen_args);
+                        p_gen_inst = (PEAPI.GenericTypeInst) class_ref.ResolveInstance (code_gen, gen_args);
 
-                        ptype = Modify (code_gen, ptype);
+                        ptype = Modify (code_gen, p_gen_inst);
 
                         is_resolved = true;
                 }
 
-                /* Resolves, AND adds to the TypeSpec table,
-		   called from TypeDef.Define for base class and
-		   interface implementations.
-		   
-		   Not required to be called for method/field refs, as
-		   PEFile's AddMethodToTypeSpec & AddFieldToTypeSpec is
-		   used which adds it to the TypeSpec table.
-		 */
-                public void ResolveAsClass (CodeGen code_gen)
+                public void Resolve (CodeGen code_gen)
                 {
-                        Resolve (code_gen);
+                        ResolveOnly (code_gen);
                         if (is_added)
                                 return;
 
-                        code_gen.PEFile.AddGenericClass ((PEAPI.GenericTypeInst) ptype);
+                        code_gen.PEFile.AddGenericClass ((PEAPI.GenericTypeInst) p_gen_inst);
                         is_added = true;
                 }
 

+ 5 - 1
mcs/ilasm/codegen/Local.cs

@@ -45,7 +45,11 @@ namespace Mono.ILASM {
                 public PEAPI.Local GetPeapiLocal (CodeGen code_gen)
                 {
                         int ec = code_gen.Report.ErrorCount;
-                        type.Resolve (code_gen);
+                        GenericTypeInst gti = type as GenericTypeInst;
+                        if (gti == null)
+                                type.Resolve (code_gen);
+                        else
+                                gti.ResolveOnly (code_gen);
 
                         if (code_gen.Report.ErrorCount > ec)
                                 return null;

+ 2 - 10
mcs/ilasm/codegen/TypeDef.cs

@@ -303,11 +303,7 @@ namespace Mono.ILASM {
                         
                         if (parent != null) {
                                 is_intransit = true;
-                                GenericTypeInst gti = parent as GenericTypeInst;
-                                if (gti != null)
-                                        gti.ResolveAsClass (code_gen);
-                                else
-                                        parent.Resolve (code_gen);
+                                parent.Resolve (code_gen);
 
                                 is_intransit = false;
                                 if (parent.PeapiClass == null) {
@@ -364,11 +360,7 @@ namespace Mono.ILASM {
 
                         if (impl_list != null) {
                                 foreach (IClassRef impl in impl_list) {
-                                        GenericTypeInst gti = impl as GenericTypeInst;
-                                        if (gti != null)
-                                                gti.ResolveAsClass (code_gen);
-                                        else
-                                                impl.Resolve (code_gen);
+                                        impl.Resolve (code_gen);
                                         classdef.AddImplementedInterface (impl.PeapiClass);
                                 }
                         }