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

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 | « lib/compiler/implementation/elements/elements.dart ('k') | 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..acca3734618dd60e3c63922d3eec48a3896dc885 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -1500,7 +1500,8 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
Element target = resolveSend(node);
Element setter = target;
Element getter = target;
- String source = node.assignmentOperator.source.stringValue;
+ SourceString operatorName = node.assignmentOperator.source;
+ String source = operatorName.stringValue;
bool isComplex = source !== '=';
if (!Elements.isUnresolved(target)
&& target.kind == ElementKind.ABSTRACT_FIELD) {
@@ -1549,13 +1550,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(Elements.mapToUserOperator(operatorName));
+ }
}
registerSend(selector, setter);
« no previous file with comments | « lib/compiler/implementation/elements/elements.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698