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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 1050133006: Add structural equality to ConstantExpression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 5 years, 8 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/constants/expressions.dart ('k') | pkg/compiler/lib/src/cps_ir/optimizers.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index c2941500aa2407178de9332d7b577747b9032c18..d436b4b38783a6880af37371ad5182d04362b092 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -685,40 +685,45 @@ abstract class IrBuilder {
return addPrimitive(new ir.Constant(constant));
}
- // Helper for building primitive constants.
- ir.Constant _buildPrimitiveConstant(PrimitiveConstantValue constant) {
- return buildConstant(new PrimitiveConstantExpression(constant));
- }
-
/// Create an integer constant and add it to the CPS term.
ir.Constant buildIntegerConstant(int value) {
- return _buildPrimitiveConstant(state.constantSystem.createInt(value));
+ return buildConstant(new IntConstantExpression(
+ value,
+ state.constantSystem.createInt(value)));
}
/// Create a double constant and add it to the CPS term.
ir.Constant buildDoubleConstant(double value) {
- return _buildPrimitiveConstant(state.constantSystem.createDouble(value));
+ return buildConstant(new DoubleConstantExpression(
+ value,
+ state.constantSystem.createDouble(value)));
}
/// Create a Boolean constant and add it to the CPS term.
ir.Constant buildBooleanConstant(bool value) {
- return _buildPrimitiveConstant(state.constantSystem.createBool(value));
+ return buildConstant(new BoolConstantExpression(
+ value,
+ state.constantSystem.createBool(value)));
}
/// Create a null constant and add it to the CPS term.
ir.Constant buildNullConstant() {
- return _buildPrimitiveConstant(state.constantSystem.createNull());
+ return buildConstant(new NullConstantExpression(
+ state.constantSystem.createNull()));
}
/// Create a string constant and add it to the CPS term.
ir.Constant buildStringConstant(String value) {
- return _buildPrimitiveConstant(
- state.constantSystem.createString(new ast.DartString.literal(value)));
+ return buildConstant(new StringConstantExpression(
+ value,
+ state.constantSystem.createString(new ast.DartString.literal(value))));
}
/// Create a string constant and add it to the CPS term.
ir.Constant buildDartStringConstant(ast.DartString value) {
- return _buildPrimitiveConstant(state.constantSystem.createString(value));
+ return buildConstant(new StringConstantExpression(
+ value.slowToString(),
+ state.constantSystem.createString(value)));
}
/// Creates a non-constant list literal of the provided [type] and with the
@@ -1935,7 +1940,8 @@ abstract class IrBuilder {
ir.Continuation elseContinuation = new ir.Continuation([]);
ir.Constant makeBoolConstant(bool value) {
- return new ir.Constant(new PrimitiveConstantExpression(
+ return new ir.Constant(new BoolConstantExpression(
+ value,
state.constantSystem.createBool(value)));
}
« no previous file with comments | « pkg/compiler/lib/src/constants/expressions.dart ('k') | pkg/compiler/lib/src/cps_ir/optimizers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698