Author: ankit
Date: 2006-01-09 11:37:26 -0500 (Mon, 09 Jan 2006)
New Revision: 55242

Modified:
   trunk/mcs/ilasm/codegen/ChangeLog
   trunk/mcs/ilasm/codegen/GenericArguments.cs
Log:
* GenericArguments.cs (GenericArguments.is_resolved): New.
(GenericArguments.p_type_list): New. Resolve only once and return this.


Modified: trunk/mcs/ilasm/codegen/ChangeLog
===================================================================
--- trunk/mcs/ilasm/codegen/ChangeLog   2006-01-09 16:22:54 UTC (rev 55241)
+++ trunk/mcs/ilasm/codegen/ChangeLog   2006-01-09 16:37:26 UTC (rev 55242)
@@ -1,5 +1,10 @@
 2006-01-09  Ankit Jain  <[EMAIL PROTECTED]>
 
+       * GenericArguments.cs (GenericArguments.is_resolved): New.
+       (GenericArguments.p_type_list): New. Resolve only once and return this.
+
+2006-01-09  Ankit Jain  <[EMAIL PROTECTED]>
+
        * TypeDef.cs (TypeDef.Define): Set is_defined to true as soon as the
        Peapi type gets created.
 

Modified: trunk/mcs/ilasm/codegen/GenericArguments.cs
===================================================================
--- trunk/mcs/ilasm/codegen/GenericArguments.cs 2006-01-09 16:22:54 UTC (rev 
55241)
+++ trunk/mcs/ilasm/codegen/GenericArguments.cs 2006-01-09 16:37:26 UTC (rev 
55242)
@@ -7,9 +7,6 @@
 // Copyright 2005 Novell, Inc (http://www.novell.com)
 //
 
-//Note: This is shared by modified types of the same generic instance
-//      Eg. foo`1<int32> and foo`1<int32> [] would share their GenericArguments
-
 using System;
 using System.Collections;
 using System.Text;
@@ -20,12 +17,16 @@
                ArrayList type_list;
                string type_str;
                ITypeRef [] type_arr;
+               bool is_resolved;
+               PEAPI.Type [] p_type_list;
 
                public GenericArguments ()
                {
                        type_list = null;
                        type_arr = null;
                        type_str = null;
+                       is_resolved = false;
+                       p_type_list = null;
                }
 
                public int Count {
@@ -56,13 +57,17 @@
 
                public PEAPI.Type [] Resolve (CodeGen code_gen)
                {
+                       if (is_resolved)
+                               return p_type_list;
+
                        int i = 0;
-                       PEAPI.Type [] p_type_list = new PEAPI.Type 
[type_list.Count];
+                       p_type_list = new PEAPI.Type [type_list.Count];
                        foreach (ITypeRef type in type_list) {
                                type.Resolve (code_gen);
                                p_type_list [i ++] = type.PeapiType;
                        }
-
+                       is_resolved = true;
+                       type_str = null;
                        return p_type_list;
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to