[w32handle] Stop returning 0 in every cases for locking/unlocking (#3926)
[mono.git] / mcs / tools / linker / Mono.Linker.Steps / ResolveFromAssemblyStep.cs
index 9872cbeb1312568ee825c3814bd3c59654e6c016..6219bc92ffc27d21e83361e511e2dce69db5508e 100644 (file)
@@ -56,25 +56,43 @@ namespace Mono.Linker.Steps {
                        switch (assembly.MainModule.Kind) {
                        case ModuleKind.Dll:
                                ProcessLibrary (Context, assembly);
-                               return;
+                               break;
                        default:
                                ProcessExecutable (assembly);
-                               return;
+                               break;
                        }
                }
 
+               static void SetAction (LinkContext context, AssemblyDefinition assembly, AssemblyAction action)
+               {
+                       TryReadSymbols (context, assembly);
+
+                       context.Annotations.SetAction (assembly, action);
+               }
+
+               static void TryReadSymbols (LinkContext context, AssemblyDefinition assembly)
+               {
+                       context.SafeReadSymbols (assembly);
+               }
+
                public static void ProcessLibrary (LinkContext context, AssemblyDefinition assembly)
                {
-                       context.Annotations.SetAction (assembly, AssemblyAction.Copy);
+                       SetAction (context, assembly, AssemblyAction.Copy);
+
+                       context.Annotations.Push (assembly);
 
                        foreach (TypeDefinition type in assembly.MainModule.Types)
                                MarkType (context, type);
+
+                       context.Annotations.Pop ();
                }
 
                static void MarkType (LinkContext context, TypeDefinition type)
                {
                        context.Annotations.Mark (type);
 
+                       context.Annotations.Push (type);
+
                        if (type.HasFields)
                                MarkFields (context, type.Fields);
                        if (type.HasMethods)
@@ -82,14 +100,20 @@ namespace Mono.Linker.Steps {
                        if (type.HasNestedTypes)
                                foreach (var nested in type.NestedTypes)
                                        MarkType (context, nested);
+
+                       context.Annotations.Pop ();
                }
 
                void ProcessExecutable (AssemblyDefinition assembly)
                {
-                       Annotations.SetAction (assembly, AssemblyAction.Link);
+                       SetAction (Context, assembly, AssemblyAction.Link);
+
+                       Annotations.Push (assembly);
 
                        Annotations.Mark (assembly.EntryPoint.DeclaringType);
                        MarkMethod (Context, assembly.EntryPoint, MethodAction.Parse);
+
+                       Annotations.Pop ();
                }
 
                static void MarkFields (LinkContext context, ICollection fields)