[mono/mono] b31c9486: [linker]: Fix my previous commit.
| Newsgroups | gmane.comp.gnome.mono.patches |
|---|---|
| Message-ID | <00000141f1a6f843-40bab805-8334-44bf-8a30-181b874a022c-000000@email.amazonses.com> |
Branch: refs/heads/mono-3.2.4-branch
Home: https://github.com/mono/mono
Compare: https://github.com/mono/mono/compare/c29ac46c408a...b31c9486e3dd
Commit: b31c9486e3dddb70cc877962a51e3bbe476c42eb
Author: Martin Baulig <[email protected]> (baulig)
Date: 2013-10-25 22:03:49 GMT
URL: https://github.com/mono/mono/commit/b31c9486e3dddb70cc877962a51e3bbe476c42eb
[linker]: Fix my previous commit.
We need to resolve all the TypeReferences before we update their scopes.
After setting the scope to null, calling Resolve() on a nested child would
crash.
Changed paths:
M mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs
Modified: mcs/tools/linker/Mono.Linker.Steps/SweepStep.cs
===================================================================
@@ -128,10 +128,23 @@ void ResolveAllTypeReferences (AssemblyDefinition assembly)
return;
resolvedTypeReferences.Add (assembly);
+ var hash = new Dictionary<TypeReference,IMetadataScope> ();
+
foreach (TypeReference tr in assembly.MainModule.GetTypeReferences ()) {
+ if (hash.ContainsKey (tr))
+ continue;
var td = tr.Resolve ();
// at this stage reference might include things that can't be resolved
- tr.Scope = td == null ? null : assembly.MainModule.Import (td).Scope;
+ var scope = td == null ? null : assembly.MainModule.Import (td).Scope;
+ hash.Add (tr, scope);
+ }
+
+ // Resolve everything first before updating scopes.
+ // If we set the scope to null, then calling Resolve() on any of its
+ // nested types would crash.
+
+ foreach (var e in hash) {
+ e.Key.Scope = e.Value;
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches