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

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

Issue 2864363002: Remove DartString from constants. (Closed)
Patch Set: Remove toDartString Created 3 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
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 ca0c11c5434e6eb7dfc1e255668b74e48183b2fd..210a120ea3f5cc5c5f833ed403957e4fc6bd7fd2 100644
--- a/pkg/compiler/lib/src/constant_system_dart.dart
+++ b/pkg/compiler/lib/src/constant_system_dart.dart
@@ -8,7 +8,6 @@ import 'constants/constant_system.dart';
import 'constants/values.dart';
import 'common_elements.dart' show CommonElements;
import 'elements/types.dart';
-import 'tree/dartstring.dart' show DartString;
const DART_CONSTANT_SYSTEM = const DartConstantSystem();
@@ -254,8 +253,7 @@ class AddOperation implements BinaryOperation {
} else if (left.isString && right.isString) {
StringConstantValue leftString = left;
StringConstantValue rightString = right;
- DartString result = new DartString.concat(
- leftString.primitiveValue, rightString.primitiveValue);
+ String result = leftString.primitiveValue + rightString.primitiveValue;
return DART_CONSTANT_SYSTEM.createString(result);
} else {
return null;
@@ -369,10 +367,9 @@ class CodeUnitAtRuntimeOperation extends CodeUnitAtOperation {
if (left.isString && right.isInt) {
StringConstantValue stringConstant = left;
IntConstantValue indexConstant = right;
- DartString dartString = stringConstant.primitiveValue;
+ String string = stringConstant.primitiveValue;
int index = indexConstant.primitiveValue;
- if (index < 0 || index >= dartString.length) return null;
- String string = dartString.slowToString();
+ if (index < 0 || index >= string.length) return null;
int value = string.codeUnitAt(index);
return DART_CONSTANT_SYSTEM.createInt(value);
}
@@ -431,7 +428,7 @@ class DartConstantSystem extends ConstantSystem {
DoubleConstantValue createDouble(double d) => new DoubleConstantValue(d);
@override
- StringConstantValue createString(DartString string) {
+ StringConstantValue createString(String string) {
return new StringConstantValue(string);
}
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | pkg/compiler/lib/src/constants/constant_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698