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

Unified Diff: pkg/compiler/lib/src/compile_time_constants.dart

Issue 1115183002: Add ConstantConstructor to ConstantExpression system. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 5 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
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698