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 0f9a0d6225185ee4b6755eb6473fe564bc29324c..e1d468df5e05de6363e5362ab8b0d18fbb56f547 100644 |
--- a/pkg/compiler/lib/src/constant_system_dart.dart |
+++ b/pkg/compiler/lib/src/constant_system_dart.dart |
@@ -348,20 +348,13 @@ class IfNullOperation implements BinaryOperation { |
apply(left, right) => left ?? right; |
} |
-abstract class CodeUnitAtOperation implements BinaryOperation { |
- final String name = 'charCodeAt'; |
+class CodeUnitAtOperation implements BinaryOperation { |
+ String get name => 'charCodeAt'; |
const CodeUnitAtOperation(); |
+ ConstantValue fold(ConstantValue left, ConstantValue right) => null; |
apply(left, right) => left.codeUnitAt(right); |
} |
-class CodeUnitAtConstantOperation extends CodeUnitAtOperation { |
- const CodeUnitAtConstantOperation(); |
- ConstantValue fold(ConstantValue left, ConstantValue right) { |
- // 'a'.codeUnitAt(0) is not a constant expression. |
- return null; |
- } |
-} |
- |
class CodeUnitAtRuntimeOperation extends CodeUnitAtOperation { |
const CodeUnitAtRuntimeOperation(); |
IntConstantValue fold(ConstantValue left, ConstantValue right) { |
@@ -379,6 +372,14 @@ class CodeUnitAtRuntimeOperation extends CodeUnitAtOperation { |
} |
} |
+class UnfoldedUnaryOperation implements UnaryOperation { |
+ final String name; |
+ const UnfoldedUnaryOperation(this.name); |
+ ConstantValue fold(ConstantValue constant) { |
+ return null; |
+ } |
+} |
+ |
/** |
* A constant system implementing the Dart semantics. This system relies on |
* the underlying runtime-system. That is, if dart2js is run in an environment |
@@ -409,7 +410,8 @@ class DartConstantSystem extends ConstantSystem { |
final shiftRight = const ShiftRightOperation(); |
final subtract = const SubtractOperation(); |
final truncatingDivide = const TruncatingDivideOperation(); |
- final codeUnitAt = const CodeUnitAtConstantOperation(); |
+ final codeUnitAt = const CodeUnitAtOperation(); |
+ final round = const UnfoldedUnaryOperation('round'); |
const DartConstantSystem(); |