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

Unified Diff: lib/compiler/implementation/resolver.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 | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/resolver.dart
diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart
index 3de67b305322f456a1d5ef3c13fef8c238b0f5ca..7b25c847eebadad0a4e6185b45499a8c073c916c 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -1549,13 +1549,16 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
}
// Make sure we include the + and - operators if we are using
- // the ++ and -- ones.
+ // the ++ and -- ones. Also, if op= form is used, include op itself.
void registerBinaryOperator(SourceString name) {
Selector binop = new Selector.binaryOperator(name);
world.registerDynamicInvocation(binop.name, binop);
}
if (source === '++') registerBinaryOperator(const SourceString('+'));
if (source === '--') registerBinaryOperator(const SourceString('-'));
+ if (source.endsWith('=')) {
+ registerBinaryOperator(new SourceString(source));
ahe 2012/09/24 09:19:31 This will register '+=' as a binary operator. But
Anton Muhin 2012/09/24 09:22:30 That's somewhat surprising, but it actually works
ahe 2012/09/24 11:14:55 I agree this is surprising, and I don't think this
Anton Muhin 2012/09/24 13:13:07 Peter, you should know this stuff better. Anyway,
ahe 2012/09/24 13:22:24 dart2dart is not a short-term priority, so we can
Anton Muhin 2012/09/24 13:23:31 What would be your advice then On 2012/09/24 13:2
ahe 2012/09/24 13:50:30 Create a method that maps a compound operator to i
ahe 2012/09/24 16:07:55 Or even better: take Elements.mapToUserOperator fr
Anton Muhin 2012/09/24 16:09:18 Thanks a lot, Peter, let me give it a try. On 201
Anton Muhin 2012/09/25 10:05:51 Done, ptal On 2012/09/24 16:09:18, Anton Muhin wr
+ }
}
registerSend(selector, setter);
« no previous file with comments | « no previous file | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698