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

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

Issue 16101007: Implement LibraryMirror.metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix issues found during testing. 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/compile_time_constants.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart b/dart/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
index 47b66c2032b57ae5296f627c7515181bb7b00571..7a31f2e3a897f161a7cc5652463b2a2785733884 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
@@ -62,11 +62,13 @@ class ConstantHandler extends CompilerTask {
void registerStaticUse(Element element) {
if (isMetadata) return;
+ compiler.analyzeElement(element.declaration);
compiler.enqueuer.codegen.registerStaticUse(element);
}
void registerGetOfStaticFunction(FunctionElement element) {
if (isMetadata) return;
+ compiler.analyzeElement(element.declaration);
compiler.enqueuer.codegen.registerGetOfStaticFunction(element);
}
@@ -124,7 +126,7 @@ class ConstantHandler extends CompilerTask {
return result;
}
return compiler.withCurrentElement(element, () {
- TreeElements definitions = compiler.analyzeElement(element);
+ TreeElements definitions = compiler.analyzeElement(element.declaration);
Constant constant = compileVariableWithDefinitions(
element, definitions, isConst: isConst);
return constant;
@@ -645,6 +647,10 @@ class CompileTimeConstantEvaluator extends Visitor {
Send send = node.send;
FunctionElement constructor = elements[send];
+ // TODO(ahe): This is nasty: we must eagerly analyze the
+ // constructor to ensure the redirectionTarget has been computed
+ // correctly. Find a way to avoid this.
+ compiler.analyzeElement(constructor.declaration);
constructor = constructor.redirectionTarget;
ClassElement classElement = constructor.getEnclosingClass();
// The constructor must be an implementation to ensure that field

Powered by Google App Engine
This is Rietveld 408576698