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

Unified Diff: pkg/compiler/lib/src/resolution/operators.dart

Issue 1192103002: Support serialization of the compiler backbone. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments Created 5 years, 6 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/resolution/operators.dart
diff --git a/pkg/compiler/lib/src/resolution/operators.dart b/pkg/compiler/lib/src/resolution/operators.dart
index 4b9ec51968192cb284629641b327e0e52b5e27b7..ac202aa0f5645dbd377757228f993a36ce6c8826 100644
--- a/pkg/compiler/lib/src/resolution/operators.dart
+++ b/pkg/compiler/lib/src/resolution/operators.dart
@@ -49,6 +49,14 @@ class UnaryOperator {
default: return null;
}
}
+
+ static UnaryOperator fromKind(UnaryOperatorKind kind) {
+ switch (kind) {
+ case UnaryOperatorKind.NOT: return NOT;
+ case UnaryOperatorKind.NEGATE: return NEGATE;
+ case UnaryOperatorKind.COMPLEMENT: return COMPLEMENT;
+ }
+ }
}
enum BinaryOperatorKind {
@@ -198,6 +206,32 @@ class BinaryOperator {
default: return null;
}
}
+
+ static BinaryOperator fromKind(BinaryOperatorKind kind) {
+ switch (kind) {
+ case BinaryOperatorKind.EQ: return EQ;
+ case BinaryOperatorKind.NOT_EQ: return NOT_EQ;
+ case BinaryOperatorKind.INDEX: return INDEX;
+ case BinaryOperatorKind.MUL: return MUL;
+ case BinaryOperatorKind.DIV: return DIV;
+ case BinaryOperatorKind.MOD: return MOD;
+ case BinaryOperatorKind.IDIV: return IDIV;
+ case BinaryOperatorKind.ADD: return ADD;
+ case BinaryOperatorKind.SUB: return SUB;
+ case BinaryOperatorKind.SHL: return SHL;
+ case BinaryOperatorKind.SHR: return SHR;
+ case BinaryOperatorKind.GTEQ: return GTEQ;
+ case BinaryOperatorKind.GT: return GT;
+ case BinaryOperatorKind.LTEQ: return LTEQ;
+ case BinaryOperatorKind.LT: return LT;
+ case BinaryOperatorKind.AND: return AND;
+ case BinaryOperatorKind.XOR: return XOR;
+ case BinaryOperatorKind.OR: return OR;
+ case BinaryOperatorKind.LOGICAL_AND: return LOGICAL_AND;
+ case BinaryOperatorKind.LOGICAL_OR: return LOGICAL_OR;
+ case BinaryOperatorKind.IF_NULL: return IF_NULL;
+ }
+ }
}
/// The operator !=, which is not user definable operator but instead is a

Powered by Google App Engine
This is Rietveld 408576698