Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/linker/Linker.Steps/SweepStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,22 @@ protected virtual void SweepMethods (Collection<MethodDefinition> methods)
void SweepOverrides (MethodDefinition method)
{
for (int i = 0; i < method.Overrides.Count;) {
if (Context.Resolve (method.Overrides[i]) is MethodDefinition ov && ShouldRemove (ov))
if (Context.Resolve (method.Overrides[i]) is MethodDefinition ov && ShouldRemove (ov) && !IgnoreScope (ov.DeclaringType.Scope))
method.Overrides.RemoveAt (i);
else
i++;
}
}

/// <summary>
/// Returns true if the assembly of the <paramref name="scope"></paramref> is not set to link (i.e. action=copy is set for that assembly)
/// </summary>
private bool IgnoreScope (IMetadataScope scope)
{
AssemblyDefinition? assembly = Context.Resolve (scope);
return assembly != null && Annotations.GetAction (assembly) != AssemblyAction.Link;
}

void SweepDebugInfo (Collection<MethodDefinition> methods)
{
List<ScopeDebugInformation>? sweptScopes = null;
Expand Down