diff options
author | Ankit Jain <radical@corewars.org> | 2006-01-06 15:24:19 +0300 |
---|---|---|
committer | Ankit Jain <radical@corewars.org> | 2006-01-06 15:24:19 +0300 |
commit | 5d8e0ff8d2942ebf4dba2d585f01bc5dd4e78900 (patch) | |
tree | 44b4b31c1fd4151d1f102f7d60263bfb730a05d0 /mcs | |
parent | d364a58d8685728c7f7b226e629f3c716671ced0 (diff) |
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
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/ilasm/codegen/ChangeLog | 13 | ||||
-rw-r--r-- | mcs/ilasm/codegen/GenericTypeInst.cs | 23 | ||||
-rw-r--r-- | mcs/ilasm/codegen/Local.cs | 6 | ||||
-rw-r--r-- | mcs/ilasm/codegen/TypeDef.cs | 12 |
4 files changed, 29 insertions, 25 deletions
diff --git a/mcs/ilasm/codegen/ChangeLog b/mcs/ilasm/codegen/ChangeLog index e3a087cc559..c534b31075f 100644 --- a/mcs/ilasm/codegen/ChangeLog +++ b/mcs/ilasm/codegen/ChangeLog @@ -1,5 +1,18 @@ 2006-01-06 Ankit Jain <jankit@novell.com> + 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 <jankit@novell.com> + * IClassRef.cs (IClassRef.Clone): New. (IClassRef.GetGenericTypeInst): Get the Generic Instance of the IClassRef. (IClassRef.ResolveInstance): Resolves the generic instance and returns the diff --git a/mcs/ilasm/codegen/GenericTypeInst.cs b/mcs/ilasm/codegen/GenericTypeInst.cs index 38bf458b644..f809df0d1c3 100644 --- a/mcs/ilasm/codegen/GenericTypeInst.cs +++ b/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; } diff --git a/mcs/ilasm/codegen/Local.cs b/mcs/ilasm/codegen/Local.cs index f74170f5f66..7560feee165 100644 --- a/mcs/ilasm/codegen/Local.cs +++ b/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; diff --git a/mcs/ilasm/codegen/TypeDef.cs b/mcs/ilasm/codegen/TypeDef.cs index a5815b71233..0f7fb15a823 100644 --- a/mcs/ilasm/codegen/TypeDef.cs +++ b/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); } } |