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 c16a09ceba8378ce060892a619fe6d0c31164acc..f9da31435ca5dca9a65e61feff9cbba2eccb75cd 100644 |
--- a/pkg/compiler/lib/src/compile_time_constants.dart |
+++ b/pkg/compiler/lib/src/compile_time_constants.dart |
@@ -755,16 +755,6 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> { |
constructor == compiler.boolEnvironment || |
constructor == compiler.stringEnvironment) { |
- AstConstant createEvaluatedConstant(ConstantValue value) { |
- return new AstConstant( |
- context, node, new ConstructedConstantExpression( |
- value, |
- type, |
- constructor, |
- elements.getSelector(send).callStructure, |
- concreteArguments.map((e) => e.expression).toList())); |
- } |
- |
var firstArgument = normalizedArguments[0].value; |
ConstantValue defaultValue = normalizedArguments[1].value; |
@@ -809,8 +799,26 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> { |
return null; |
} |
+ String name = |
+ firstArgument.primitiveValue.slowToString(); |
String value = |
- compiler.fromEnvironment(firstArgument.primitiveValue.slowToString()); |
+ compiler.fromEnvironment(name); |
+ |
+ AstConstant createEvaluatedConstant(ConstantValue value) { |
+ |
+ ConstantExpression expression; |
+ if (constructor == compiler.intEnvironment) { |
+ expression = new IntFromEnvironmentConstantExpression( |
+ value, name, normalizedArguments[1].expression); |
+ } else if (constructor == compiler.boolEnvironment) { |
+ expression = new BoolFromEnvironmentConstantExpression( |
+ value, name, normalizedArguments[1].expression); |
+ } else if (constructor == compiler.stringEnvironment) { |
+ expression = new StringFromEnvironmentConstantExpression( |
+ value, name, normalizedArguments[1].expression); |
+ } |
+ return new AstConstant(context, node, expression); |
+ } |
if (value == null) { |
return createEvaluatedConstant(defaultValue); |