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

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

Issue 10942029: Resolve op when op= syntax is used. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 6ecc0848ff4121fed3d06d52c5e05d18925784c2..791a7e5dcc576e1580dc3d717db1bf437aa5c264 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -1655,6 +1655,25 @@ class Elements {
return new SourceString('operator\$$str');
}
+ static SourceString mapToUserOperator(SourceString op) {
+ String value = op.stringValue;
+
+ if (value === '!=') return const SourceString('==');
+ if (value === '*=') return const SourceString('*');
+ if (value === '/=') return const SourceString('/');
+ if (value === '%=') return const SourceString('%');
+ if (value === '~/=') return const SourceString('~/');
+ if (value === '+=') return const SourceString('+');
+ if (value === '-=') return const SourceString('-');
+ if (value === '<<=') return const SourceString('<<');
+ if (value === '>>=') return const SourceString('>>');
+ if (value === '&=') return const SourceString('&');
+ if (value === '^=') return const SourceString('^');
+ if (value === '|=') return const SourceString('|');
+
+ throw 'Unhandled operator: ${op.slowToString()}';
+ }
+
static bool isNumberOrStringSupertype(Element element, Compiler compiler) {
LibraryElement coreLibrary = compiler.coreLibrary;
return (element == coreLibrary.find(const SourceString('Comparable')))
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698