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

Unified Diff: sdk/lib/_internal/compiler/implementation/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: Add null check. Created 6 years, 3 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: sdk/lib/_internal/compiler/implementation/constant_system_dart.dart
diff --git a/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart b/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart
index 19e084ed4a58128446c7fbe5126535c2f65f6da3..2ee5413e38a36feb3d6077805f45d367e5f5b0c1 100644
--- a/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart
+++ b/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart
@@ -231,6 +231,12 @@ class AddOperation implements BinaryOperation {
NumConstant rightNum = right;
double result = leftNum.value + rightNum.value;
return DART_CONSTANT_SYSTEM.createDouble(result);
+ } else if (left.isString && right.isString) {
+ StringConstant leftString = left;
+ StringConstant rightString = right;
+ DartString result =
+ new DartString.concat(leftString.value, rightString.value);
+ return DART_CONSTANT_SYSTEM.createString(result);
} else {
return null;
}

Powered by Google App Engine
This is Rietveld 408576698