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)
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)