Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 16101007: Implement LibraryMirror.metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698