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 |