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

Unified Diff: pkg/compiler/lib/src/constants/constant_system.dart

Issue 1070293004: Use UnaryOperator and BinaryOperator in ConstantSystem. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reinsert from bad merge 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/compile_time_constants.dart ('k') | pkg/compiler/lib/src/constants/expressions.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/constants/constant_system.dart
diff --git a/pkg/compiler/lib/src/constants/constant_system.dart b/pkg/compiler/lib/src/constants/constant_system.dart
index cac7b93c00150cee12520d5c2bbb7f7d9c5192d4..e8260b994dec4edcb6e3ab787e058049a48864c7 100644
--- a/pkg/compiler/lib/src/constants/constant_system.dart
+++ b/pkg/compiler/lib/src/constants/constant_system.dart
@@ -6,6 +6,7 @@ library dart2js.constant_system;
import '../dart_types.dart';
import '../dart2jslib.dart' show Compiler;
+import '../resolution/operators.dart';
import '../tree/tree.dart' show DartString;
import 'values.dart';
@@ -80,35 +81,35 @@ abstract class ConstantSystem {
/** Returns true if the [constant] is null at runtime. */
bool isNull(ConstantValue constant);
- UnaryOperation lookupUnary(String operator) {
- switch (operator) {
- case '~': return bitNot;
- case '-': return negate;
- case '!': return not;
+ UnaryOperation lookupUnary(UnaryOperator operator) {
+ switch (operator.kind) {
+ case UnaryOperatorKind.COMPLEMENT: return bitNot;
+ case UnaryOperatorKind.NEGATE: return negate;
+ case UnaryOperatorKind.NOT: return not;
default: return null;
}
}
- BinaryOperation lookupBinary(String operator) {
- switch (operator) {
- case "+": return add;
- case "-": return subtract;
- case "*": return multiply;
- case "/": return divide;
- case "%": return modulo;
- case "~/": return truncatingDivide;
- case "|": return bitOr;
- case "&": return bitAnd;
- case "^": return bitXor;
- case "||": return booleanOr;
- case "&&": return booleanAnd;
- case "<<": return shiftLeft;
- case ">>": return shiftRight;
- case "<": return less;
- case "<=": return lessEqual;
- case ">": return greater;
- case ">=": return greaterEqual;
- case "==": return equal;
+ BinaryOperation lookupBinary(BinaryOperator operator) {
+ switch (operator.kind) {
+ case BinaryOperatorKind.ADD: return add;
+ case BinaryOperatorKind.SUB: return subtract;
+ case BinaryOperatorKind.MUL: return multiply;
+ case BinaryOperatorKind.DIV: return divide;
+ case BinaryOperatorKind.MOD: return modulo;
+ case BinaryOperatorKind.IDIV: return truncatingDivide;
+ case BinaryOperatorKind.OR: return bitOr;
+ case BinaryOperatorKind.AND: return bitAnd;
+ case BinaryOperatorKind.XOR: return bitXor;
+ case BinaryOperatorKind.LOGICAL_OR: return booleanOr;
+ case BinaryOperatorKind.LOGICAL_AND: return booleanAnd;
+ case BinaryOperatorKind.SHL: return shiftLeft;
+ case BinaryOperatorKind.SHR: return shiftRight;
+ case BinaryOperatorKind.LT: return less;
+ case BinaryOperatorKind.LTEQ: return lessEqual;
+ case BinaryOperatorKind.GT: return greater;
+ case BinaryOperatorKind.GTEQ: return greaterEqual;
+ case BinaryOperatorKind.EQ: return equal;
default: return null;
}
}
« no previous file with comments | « pkg/compiler/lib/src/compile_time_constants.dart ('k') | pkg/compiler/lib/src/constants/expressions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698