Index: dart/sdk/lib/_internal/compiler/implementation/compiler.dart |
diff --git a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart |
index f14543f3dcae2b23c108967dfbc57f81277b579e..0c8865f49fddc61f004517dfa672a0abd1f0dd49 100644 |
--- a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart |
+++ b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart |
@@ -643,6 +643,7 @@ abstract class Compiler implements DiagnosticListener { |
} |
if (uri == Uri.parse('dart:mirrors')) { |
mirrorSystemClass = library.find(const SourceString('MirrorSystem')); |
+ metadataHandler = constantHandler; |
} else if (uri == Uri.parse('dart:_collection-dev')) { |
symbolImplementationClass = library.find(const SourceString('Symbol')); |
} |
@@ -822,6 +823,7 @@ abstract class Compiler implements DiagnosticListener { |
// Elements required by enqueueHelpers are global dependencies |
// that are not pulled in by a particular element. |
backend.enqueueHelpers(enqueuer.resolution, globalDependencies); |
+ resolveReflectiveDataIfNeeded(); |
processQueue(enqueuer.resolution, main); |
enqueuer.resolution.logSummary(log); |
@@ -864,6 +866,17 @@ abstract class Compiler implements DiagnosticListener { |
checkQueues(); |
} |
+ void resolveReflectiveDataIfNeeded() { |
+ // Only need reflective data when dart:mirrors is loaded. |
+ if (mirrorSystemClass == null) return; |
+ |
+ for (LibraryElement library in libraries.values) { |
+ for (Link link = library.metadata; !link.isEmpty; link = link.tail) { |
+ link.head.ensureResolved(this); |
+ } |
+ } |
+ } |
+ |
void fullyEnqueueLibrary(LibraryElement library) { |
library.forEachLocalMember(fullyEnqueueTopLevelElement); |
} |