2007-01-25 Radek Doulik <rodo@novell.com>
authorRadek Doulik <rodo@mono-cvs.ximian.com>
Mon, 29 Jan 2007 19:24:11 +0000 (19:24 -0000)
committerRadek Doulik <rodo@mono-cvs.ximian.com>
Mon, 29 Jan 2007 19:24:11 +0000 (19:24 -0000)
       * ModuleBuilder.cs: return created type from GetType in case the
       type builder type was already created. Added test-555.cs as
       regression test.

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

mcs/class/corlib/System.Reflection.Emit/ChangeLog
mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs

index 7feaaffe0446e5aaf194ddb4b5bd3521f6d5d796..ae52e22162d5f8fe928aa68f0eb1afa4a5110243 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-25  Radek Doulik  <rodo@novell.com>
+
+       * ModuleBuilder.cs: return created type from GetType in case the
+       type builder type was already created. Added test-555.cs as
+       regression test.
 
 Tue Jan 23 17:45:07 CET 2007 Paolo Molaro <lupus@ximian.com>
 
index da6092c1d4bc436d9d71915436eaf326a3a6db92..33016a7398a2212ed15187ec4097dfe82b375114 100644 (file)
@@ -391,9 +391,17 @@ namespace System.Reflection.Emit {
                        }
                        if ((result == null) && throwOnError)
                                throw new TypeLoadException (orig);
-                       if (result != null && (modifiers != null))
-                               return create_modified_type (result, modifiers);
-                       return result;
+                       if (result != null && (modifiers != null)) {
+                               Type mt = create_modified_type (result, modifiers);
+                               if (mt is TypeBuilder)
+                                       result = mt as TypeBuilder;
+                               else
+                                       return mt;
+                       }
+                       if (result != null && result.is_created)
+                               return result.CreateType ();
+                       else
+                               return result;
                }
 
                internal int get_next_table_index (object obj, int table, bool inc) {