Index: pkg/compiler/lib/src/compile_time_constants.dart |
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart |
index a1c37688a01b33dd4361e689ec7eab00fda1fd89..848ea68f32d6db5a23ea0694460aa9e615b1543a 100644 |
--- a/pkg/compiler/lib/src/compile_time_constants.dart |
+++ b/pkg/compiler/lib/src/compile_time_constants.dart |
@@ -248,6 +248,10 @@ abstract class ConstantCompilerBase implements ConstantCompiler { |
return expression; |
} |
+ void cacheConstantValue(ConstantExpression expression, ConstantValue value) { |
+ constantValueMap[expression] = value; |
+ } |
+ |
ConstantExpression compileNodeWithDefinitions(Node node, |
TreeElements definitions, |
{bool isConst: true}) { |
@@ -256,7 +260,7 @@ abstract class ConstantCompilerBase implements ConstantCompiler { |
this, definitions, compiler, isConst: isConst); |
AstConstant constant = evaluator.evaluate(node); |
if (constant != null) { |
- constantValueMap[constant.expression] = constant.value; |
+ cacheConstantValue(constant.expression, constant.value); |
return constant.expression; |
} |
return null; |
@@ -302,7 +306,7 @@ class DartConstantCompiler extends ConstantCompilerBase { |
TreeElements definitions, |
{bool isConst: true}) { |
ConstantExpression constant = definitions.getConstant(node); |
- if (constant != null) { |
+ if (constant != null && getConstantValue(constant) != null) { |
return constant; |
} |
constant = |