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 00112af187231c75e4f2f69ef9c367d07e450872..b739ce5deb6ab38a1ee6e412c14e48d63354edd6 100644 |
--- a/pkg/compiler/lib/src/compile_time_constants.dart |
+++ b/pkg/compiler/lib/src/compile_time_constants.dart |
@@ -535,7 +535,8 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> { |
StringConstantValue stringConstantValue = left.value; |
DartString string = stringConstantValue.primitiveValue; |
IntConstantValue length = constantSystem.createInt(string.length); |
- result = new VariableConstantExpression(length, element); |
+ result = |
+ new StringLengthConstantExpression(length, left.expression); |
} |
} |
// Fall through to error handling. |
@@ -880,15 +881,20 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> { |
AstConstant createEvaluatedConstant(ConstantValue value) { |
ConstantExpression expression; |
+ ConstantExpression name = concreteArguments[0].expression; |
+ ConstantExpression defaultValue; |
+ if (concreteArguments.length > 1) { |
+ defaultValue = concreteArguments[1].expression; |
+ } |
if (constructor == compiler.intEnvironment) { |
expression = new IntFromEnvironmentConstantExpression( |
- value, name, normalizedArguments[1].expression); |
+ value, name, defaultValue); |
} else if (constructor == compiler.boolEnvironment) { |
expression = new BoolFromEnvironmentConstantExpression( |
- value, name, normalizedArguments[1].expression); |
+ value, name, defaultValue); |
} else if (constructor == compiler.stringEnvironment) { |
expression = new StringFromEnvironmentConstantExpression( |
- value, name, normalizedArguments[1].expression); |
+ value, name, defaultValue); |
} |
return new AstConstant(context, node, expression); |
} |