You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
committed by
Jo Shields
parent
aa7da660d6
commit
c042cd0c52
@@ -42,8 +42,17 @@ namespace Mono.Linker.Steps {
|
||||
protected override void Process ()
|
||||
{
|
||||
assemblies = Context.GetAssemblies ();
|
||||
foreach (var assembly in assemblies)
|
||||
foreach (var assembly in assemblies) {
|
||||
SweepAssembly (assembly);
|
||||
if (Annotations.GetAction (assembly) == AssemblyAction.Copy) {
|
||||
// Copy assemblies can still contain Type references with
|
||||
// type forwarders from Delete assemblies
|
||||
// thus try to resolve all the type references and see
|
||||
// if some changed the scope. if yes change the action to Save
|
||||
if (ResolveAllTypeReferences (assembly))
|
||||
Annotations.SetAction (assembly, AssemblyAction.Save);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SweepAssembly (AssemblyDefinition assembly)
|
||||
@@ -124,15 +133,16 @@ namespace Mono.Linker.Steps {
|
||||
}
|
||||
}
|
||||
|
||||
void ResolveAllTypeReferences (AssemblyDefinition assembly)
|
||||
bool ResolveAllTypeReferences (AssemblyDefinition assembly)
|
||||
{
|
||||
if (resolvedTypeReferences == null)
|
||||
resolvedTypeReferences = new HashSet<AssemblyDefinition> ();
|
||||
if (resolvedTypeReferences.Contains (assembly))
|
||||
return;
|
||||
return false;
|
||||
resolvedTypeReferences.Add (assembly);
|
||||
|
||||
var hash = new Dictionary<TypeReference,IMetadataScope> ();
|
||||
bool changes = false;
|
||||
|
||||
foreach (TypeReference tr in assembly.MainModule.GetTypeReferences ()) {
|
||||
if (hash.ContainsKey (tr))
|
||||
@@ -141,8 +151,11 @@ namespace Mono.Linker.Steps {
|
||||
IMetadataScope scope = tr.Scope;
|
||||
// at this stage reference might include things that can't be resolved
|
||||
// and if it is (resolved) it needs to be kept only if marked (#16213)
|
||||
if ((td != null) && Annotations.IsMarked (td))
|
||||
if ((td != null) && Annotations.IsMarked (td)) {
|
||||
scope = assembly.MainModule.Import (td).Scope;
|
||||
if (tr.Scope != scope)
|
||||
changes = true;
|
||||
}
|
||||
hash.Add (tr, scope);
|
||||
}
|
||||
if (assembly.MainModule.HasExportedTypes) {
|
||||
@@ -163,6 +176,8 @@ namespace Mono.Linker.Steps {
|
||||
foreach (var e in hash) {
|
||||
e.Key.Scope = e.Value;
|
||||
}
|
||||
|
||||
return changes;
|
||||
}
|
||||
|
||||
void SweepType (TypeDefinition type)
|
||||
|
||||
Reference in New Issue
Block a user