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

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

Issue 10857033: Make sure to register +/- when we're using ++/--. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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/compiler/dart2js/resolver_test.dart » ('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 1400806740d0a4c5ecb543eb058e9fb67af87444..8cf6ee75afbc487b61aaa15a7aa2fbba21a5c0d5 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -1308,21 +1308,30 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
// unqualified.
Selector selector = mapping.getSelector(node);
- Identifier identifier = node.assignmentOperator;
- bool isCompound = identifier.source.stringValue !== '=';
- if (isCompound) {
+ String source = node.assignmentOperator.source.stringValue;
+ bool isComplex = source !== '=';
+ if (isComplex) {
if (selector.isSetter()) {
useElement(node.selector, getter);
registerSend(new Selector.getterFrom(selector), getter);
} else {
// TODO(kasperl): If [getter] is resolved, it will actually
// refer to the []= operator which isn't the one we want to
- // register here. We should consider using some notation of
+ // register here. We should consider using some notion of
// abstract indexable element that we can resolve to so we can
// distinguish the two.
assert(selector.isIndexSet());
registerSend(new Selector.index(), null);
}
+
+ // Make sure we include the + and - operators if we are using
+ // the ++ and -- ones.
+ 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('-'));
}
registerSend(selector, setter);
« no previous file with comments | « no previous file | tests/compiler/dart2js/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698