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 fbdc8ca869b2c28100bb168594afdfa5b2fb45bf..2942c4ea586b1235abdd7ac49149ffbb1586df51 100644 |
--- a/sdk/lib/_internal/compiler/implementation/elements/elements.dart |
+++ b/sdk/lib/_internal/compiler/implementation/elements/elements.dart |
@@ -1861,7 +1861,8 @@ class Elements { |
} |
} |
- static SourceString constructOperatorName(SourceString op, bool isUnary) { |
+ static SourceString constructOperatorNameOrNull(SourceString op, |
+ bool isUnary) { |
String value = op.stringValue; |
if ((value === '==') || |
(value === '~') || |
@@ -1886,11 +1887,17 @@ class Elements { |
} else if (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('=='); |
@@ -1906,7 +1913,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) { |