[linker] We need to mark nested types even if the declaring type isn't marked.
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 4 Oct 2016 14:38:08 +0000 (16:38 +0200)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 4 Oct 2016 16:16:53 +0000 (18:16 +0200)
mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs

index 0c39910ff5ea06b2d5a538e7ebbda7b09f27f63b..bc04fc5c7c024087188ffee7b0c337305b6aae8f 100644 (file)
@@ -69,16 +69,21 @@ namespace Mono.Linker.Steps {
                protected virtual void InitializeAssembly (AssemblyDefinition assembly)
                {
                        MarkAssembly (assembly);
-                       foreach (TypeDefinition type in assembly.MainModule.Types) {
-                               if (!Annotations.IsMarked (type))
-                                       continue;
 
+                       foreach (TypeDefinition type in assembly.MainModule.Types)
                                InitializeType (type);
-                       }
                }
 
                void InitializeType (TypeDefinition type)
                {
+                       if (type.HasNestedTypes) {
+                               foreach (var nested in type.NestedTypes)
+                                       InitializeType (nested);
+                       }
+
+                       if (!Annotations.IsMarked (type))
+                               return;
+
                        MarkType (type);
 
                        if (type.HasFields)