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

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/elements.dart

Issue 11348067: Fix operator handling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Apply style remarks to the rest the file. Created 8 years, 1 month 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 | « no previous file | sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/elements/elements.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/elements.dart b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
index 44112048363739ad1362a00875ddf5e40cb3c253..d84b9893dd45a3cff5dd5ac21fb2f67c051f3217 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/elements.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
@@ -1949,7 +1949,8 @@ class Elements {
}
}
- static SourceString constructOperatorName(SourceString op, bool isUnary) {
+ static SourceString constructOperatorNameOrNull(SourceString op,
+ bool isUnary) {
String value = op.stringValue;
if ((identical(value, '==')) ||
(identical(value, '~')) ||
@@ -1974,11 +1975,17 @@ class Elements {
} else if (identical(value, '-')) {
return isUnary ? const SourceString('unary-') : op;
} else {
- throw 'Unhandled operator: ${op.slowToString()}';
+ return null;
}
}
- static SourceString mapToUserOperator(SourceString op) {
+ static SourceString constructOperatorName(SourceString op, bool isUnary) {
+ SourceString operatorName = constructOperatorNameOrNull(op, isUnary);
+ if (operatorName == null) throw 'Unhandled operator: ${op.slowToString()}';
+ else return operatorName;
+ }
+
+ static SourceString mapToUserOperatorOrNull(SourceString op) {
String value = op.stringValue;
if (identical(value, '!=')) return const SourceString('==');
@@ -1994,7 +2001,13 @@ class Elements {
if (identical(value, '^=')) return const SourceString('^');
if (identical(value, '|=')) return const SourceString('|');
- throw 'Unhandled operator: ${op.slowToString()}';
+ return null;
+ }
+
+ static SourceString mapToUserOperator(SourceString op) {
+ SourceString userOperator = mapToUserOperatorOrNull(op);
+ if (userOperator == null) throw 'Unhandled operator: ${op.slowToString()}';
+ else return userOperator;
}
static bool isNumberOrStringSupertype(Element element, Compiler compiler) {
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698