[mono/mono] edbc59e9: [linker]: Fix my previous commit.
| Newsgroups | gmane.comp.gnome.mono.patches |
|---|---|
| Message-ID | <000001420ef145a8-8a7c7456-aeaf-40d5-9304-77f2b0aca9df-000000@email.amazonses.com> |
Branch: refs/heads/master
Home: https://github.com/mono/mono
Compare: https://github.com/mono/mono/compare/96a201f7fe81...edbc59e9dbc6
Commit: edbc59e9dbc6c92d8d0dc54927e63d9a8362f6fd
Author: Martin Baulig <[email protected]> (baulig)
Committer: Sebastien Pouliot <[email protected]> (spouliot)
Date: 2013-10-31 14:34:20 GMT
URL: https://github.com/mono/mono/commit/edbc59e9dbc6c92d8d0dc54927e63d9a8362f6fd
[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