Kaynağa Gözat

In ilasm/codegen:
* BaseClassRef.cs (Clone): Move to ..
* BaseTypeRef.cs (Clone): .. here.
* Sentinel.cs: Implement abstract Clone method.
* MethodPointerTypeRef.cs: Likewise.
* PrimitiveTypeRef.cs: Likewise.
* ModifiableType (MakeCustomModified): Add to SigMod.
* GenericTypeInst.cs:
* GenericParamRef.cs:
* TypeRef.cs:
* ExternTypeRef.cs: Update.

In ilasm/parser:
* ILParser.jay (GetTypeRef): Use BaseTypeRef.Clone

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

Ankit Jain 19 yıl önce
ebeveyn
işleme
f95a20d108

+ 0 - 2
mcs/ilasm/codegen/BaseClassRef.cs

@@ -33,8 +33,6 @@ namespace Mono.ILASM {
                         get { return type as PEAPI.Class; }
                 }
 
-                public abstract BaseClassRef Clone ();
-
                 public virtual void MakeValueClass ()
                 {
                         is_valuetype = true;

+ 2 - 0
mcs/ilasm/codegen/BaseTypeRef.cs

@@ -53,6 +53,8 @@ namespace Mono.ILASM {
 
                 public abstract void Resolve (CodeGen code_gen);
 
+                public abstract BaseTypeRef Clone ();
+
                 protected abstract BaseMethodRef CreateMethodRef (BaseTypeRef ret_type,
                         PEAPI.CallConv call_conv, string name, BaseTypeRef[] param, int gen_param_count);
 

+ 12 - 0
mcs/ilasm/codegen/ChangeLog

@@ -1,3 +1,15 @@
+2007-01-10  Ankit Jain  <[email protected]>
+
+	* BaseClassRef.cs (Clone): Move to ..
+	* BaseTypeRef.cs (Clone): .. here.
+	* Sentinel.cs: Implement abstract Clone method.
+	* MethodPointerTypeRef.cs: Likewise.
+	* PrimitiveTypeRef.cs: Likewise.
+	* ModifiableType (MakeCustomModified): Add to SigMod.
+	* GenericTypeInst.cs:
+	* GenericParamRef.cs:
+	* TypeRef.cs:
+	* ExternTypeRef.cs: Update.
 
 Tue Dec 12 19:23:34 CET 2006 Paolo Molaro <[email protected]>
 

+ 1 - 1
mcs/ilasm/codegen/ExternTypeRef.cs

@@ -37,7 +37,7 @@ namespace Mono.ILASM {
                         nestedtypes_table = new Hashtable ();
                 }
                 
-                public override BaseClassRef Clone ()
+                public override BaseTypeRef Clone ()
                 {
                         return new ExternTypeRef (extern_ref, full_name, is_valuetype, 
                                         (ArrayList) ConversionList.Clone (), sig_mod);

+ 1 - 1
mcs/ilasm/codegen/GenericParamRef.cs

@@ -48,7 +48,7 @@ namespace Mono.ILASM {
                         throw new InternalErrorException ("Not supported");
                 }
 
-                public override BaseClassRef Clone ()
+                public override BaseTypeRef Clone ()
                 {
                         return new GenericParamRef (param, full_name, (ArrayList) ConversionList.Clone ());
                 }

+ 1 - 1
mcs/ilasm/codegen/GenericTypeInst.cs

@@ -48,7 +48,7 @@ namespace Mono.ILASM {
                         get { return class_ref.FullName + gen_args.ToString () + SigMod; }
                 }
 
-                public override BaseClassRef Clone ()
+                public override BaseTypeRef Clone ()
                 {
                         //Clone'd instance shares the class_ref and gen_args,
                         //as its basically used to create modified types (arrays etc)

+ 13 - 2
mcs/ilasm/codegen/MethodPointerTypeRef.cs

@@ -20,7 +20,12 @@ namespace Mono.ILASM {
                 private ArrayList param_list;
 
                 public MethodPointerTypeRef (PEAPI.CallConv callconv, BaseTypeRef ret, ArrayList param_list)
-			: base (String.Empty)
+                        : this (callconv, ret, param_list, null, String.Empty)
+                {
+                }
+
+                public MethodPointerTypeRef (PEAPI.CallConv callconv, BaseTypeRef ret, ArrayList param_list, ArrayList conv_list, string sig_mod)
+                        : base (String.Empty, conv_list, sig_mod)
                 {
                         this.callconv = callconv;
                         this.ret = ret;
@@ -28,7 +33,13 @@ namespace Mono.ILASM {
 
                         // We just need these to not break the interface
                         //full_name = String.Empty;
-                        sig_mod = String.Empty;
+                        //sig_mod = String.Empty;
+                }
+
+                public override BaseTypeRef Clone ()
+                {
+                        return new MethodPointerTypeRef (callconv, ret, (ArrayList) param_list.Clone (),
+                                        (ArrayList) ConversionList.Clone (), sig_mod);
                 }
 
                 public override void Resolve (CodeGen code_gen)

+ 5 - 0
mcs/ilasm/codegen/ModifiableType.cs

@@ -110,6 +110,11 @@ namespace Mono.ILASM {
                         conversion_list.Add (ConversionMethod.MakeCustomModified);
                         conversion_list.Add (modifier);
                         conversion_list.Add (klass);
+
+                        if (modifier == PEAPI.CustomModifier.modreq)
+                                SigMod += ("modreq (" + klass.FullName + ")");
+                        else if (modifier == PEAPI.CustomModifier.modopt)
+                                SigMod += ("modopt (" + klass.FullName + ")");
                 }
 
                 public void MakePinned ()

+ 14 - 2
mcs/ilasm/codegen/PrimitiveTypeRef.cs

@@ -21,10 +21,22 @@ namespace Mono.ILASM {
                 private static Hashtable s_method_table = new Hashtable ();
 
                 public PrimitiveTypeRef (PEAPI.PrimitiveType type, string full_name)
-                        : base (full_name)
+                        : this (type, full_name, null, String.Empty)
+                {
+                }
+
+                public PrimitiveTypeRef (PEAPI.PrimitiveType type, string full_name, ArrayList conv_list, string sig_mod)
+                        : base (full_name, conv_list, sig_mod)
                 {
                         this.type = type;
-                        SigMod = String.Empty;
+                        if (SigMod == null)
+                                SigMod = String.Empty;
+                }
+
+                public override BaseTypeRef Clone ()
+                {
+                        return new PrimitiveTypeRef ((PEAPI.PrimitiveType) type, full_name,
+                                (ArrayList) ConversionList.Clone (), sig_mod);
                 }
 
 		public string Name {

+ 12 - 1
mcs/ilasm/codegen/Sentinel.cs

@@ -8,16 +8,27 @@
 //
 
 using System;
+using System.Collections;
 
 namespace Mono.ILASM {
 
         public class SentinelTypeRef : BaseTypeRef {
 
                 public SentinelTypeRef ()
-			: base ("...")
+			: this (null, null)
                 {
                 }
 
+                public SentinelTypeRef (ArrayList conv_list, string sig_mod)
+                        : base ("...", conv_list, sig_mod)
+                {
+                }
+
+                public override BaseTypeRef Clone ()
+                {
+                        return new SentinelTypeRef ((ArrayList) ConversionList.Clone (), sig_mod);
+                }
+
                 public override void Resolve (CodeGen code_gen)
                 {
                         if (is_resolved)

+ 1 - 1
mcs/ilasm/codegen/TypeRef.cs

@@ -32,7 +32,7 @@ namespace Mono.ILASM {
                         this.location = location;
                 }
                 
-                public override BaseClassRef Clone ()
+                public override BaseTypeRef Clone ()
                 {
                         return new TypeRef (full_name, is_valuetype, location, (ArrayList) ConversionList.Clone (), sig_mod);
                 }

+ 4 - 0
mcs/ilasm/parser/ChangeLog

@@ -1,3 +1,7 @@
+2007-01-10  Ankit Jain  <[email protected]>
+
+	* ILParser.jay (GetTypeRef): Use BaseTypeRef.Clone
+
 2006-11-09  Ankit Jain  <[email protected]>
 
 	* ILParser.jay (K_RETARGETABLE): New.

+ 2 - 3
mcs/ilasm/parser/ILParser.jay

@@ -129,9 +129,8 @@ namespace Mono.ILASM {
 
                 private BaseTypeRef GetTypeRef (BaseTypeRef b)
                 {
-                        if (b is BaseClassRef)
-                                return ((BaseClassRef) b).Clone ();
-                        return b;
+                        //FIXME: Caching required.. 
+                        return b.Clone ();
                 }
 
 %}