[mono/mono] dcc4db5d: [linker]: Fix my previous commit.
| Newsgroups | gmane.comp.gnome.mono.patches |
|---|---|
| Message-ID | <00000141f1a16d18-f6c3fcce-a1e7-4449-9f49-2830bdc31405-000000@email.amazonses.com> |
Branch: refs/heads/mtvs-1.8-series
Home: https://github.com/mono/mono
Compare: https://github.com/mono/mono/compare/433017c01185...dcc4db5d78b8
Commit: dcc4db5d78b8d2c47d668d42b4b7e470be5e0fce
Author: Martin Baulig <[email protected]> (baulig)
Date: 2013-10-25 21:58:31 GMT
URL: https://github.com/mono/mono/commit/dcc4db5d78b8d2c47d668d42b4b7e470be5e0fce
[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