Use faster MemberKind when checking for a nested type
authorMarek Safar <marek.safar@gmail.com>
Fri, 22 Oct 2010 18:29:50 +0000 (19:29 +0100)
committerMarek Safar <marek.safar@gmail.com>
Fri, 22 Oct 2010 18:32:11 +0000 (19:32 +0100)
mcs/mcs/import.cs
mcs/tests/test-792-lib.il

index 972243faf8f01d7dedf9197f82a261ed2c479d83..4ad1164464672b2028caa2aecaa4c59f9ad0bfb7 100644 (file)
@@ -840,7 +840,11 @@ namespace Mono.CSharp
                        Namespace ns = targetNamespace;
                        string prev_namespace = null;
                        foreach (var t in types) {
-                               if (t == null || t.IsNested)
+                               if (t == null)
+                                       continue;
+
+                               // Be careful not to trigger full parent type loading
+                               if (t.MemberType == MemberTypes.NestedType)
                                        continue;
 
                                if (t.Name[0] == '<')
index e7d4b8bf4e25fc349c21749e9d6df40150c31cf9..620f5c1ebcb21fdbf6a61cf43f71c64b3e9aaca3 100644 (file)
   .method public hidebysig specialname rtspecialname 
           instance void  .ctor() cil managed
   {
-    .maxstack  8
     IL_0000:  ldarg.0
     IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
     IL_0006:  ret
   }  
-}
\ No newline at end of file
+}
+
+.class public auto ansi beforefieldinit Another extends ['missing-lib']XXBase
+{
+  .class auto ansi nested public beforefieldinit Nested extends [mscorlib]System.Object
+  {
+    .method public hidebysig specialname rtspecialname instance void  .ctor() cil managed
+    {
+      IL_0000:  ldarg.0
+      IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
+      IL_0006:  ret
+    }
+  }
+
+  .method public hidebysig specialname rtspecialname instance void  .ctor() cil managed
+  {
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
+    IL_0006:  ret
+  }
+}
+