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

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

Issue 585173002: dart2js: Support new const operations on strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase and status file updates. Created 5 years, 11 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
Index: pkg/compiler/lib/src/constant_system_dart.dart
diff --git a/pkg/compiler/lib/src/constant_system_dart.dart b/pkg/compiler/lib/src/constant_system_dart.dart
index 30fb62ed9186249bdd42bb8be687cb00fb789c24..0c507a7037e2230f9d114736c9612bf04e9878b8 100644
--- a/pkg/compiler/lib/src/constant_system_dart.dart
+++ b/pkg/compiler/lib/src/constant_system_dart.dart
@@ -233,6 +233,12 @@ class AddOperation implements BinaryOperation {
NumConstantValue rightNum = right;
double result = leftNum.primitiveValue + rightNum.primitiveValue;
return DART_CONSTANT_SYSTEM.createDouble(result);
+ } else if (left.isString && right.isString) {
+ StringConstantValue leftString = left;
+ StringConstantValue rightString = right;
+ DartString result = new DartString.concat(leftString.primitiveValue,
+ rightString.primitiveValue);
+ return DART_CONSTANT_SYSTEM.createString(result);
} else {
return null;
}
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | pkg/compiler/lib/src/js_backend/constant_system_javascript.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698