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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart

Issue 10905211: Clean up operator names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 years, 1 month 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
Index: dart/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart b/dart/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart
index 88d9fea4177f1d773af631b0f4c864a10ba34500..094169adaf355df82037c815c561d6030b450e18 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart
@@ -459,9 +459,7 @@ class ConcreteTypesInferrer {
final ClassBaseType int = baseTypes.intBaseType;
final ClassBaseType double = baseTypes.doubleBaseType;
final ClassBaseType num = baseTypes.numBaseType;
- for (String operator in ['add', 'mul', 'sub']) {
- final String method = r"operator$".concat(operator);
-
+ for (String method in ['+', '*', '-']) {
rule(int, method, int, int);
rule(int, method, double, num);
rule(int, method, num, num);
@@ -1050,8 +1048,14 @@ class TypeInferrerVisitor extends ResolvedVisitor<ConcreteType> {
}
SourceString canonicalizeCompoundOperator(String op) {
- if (op == '++') return const SourceString(r'operator$add');
- else return const SourceString(r'operator$sub');
+ // TODO(ahe): This class should work on elements or selectors, not
+ // names. Otherwise, it is repeating work the resolver has
+ // already done (or should have done). In this case, the problem
+ // is that the resolver is not recording the selectors it is
+ // registering in registerBinaryOperator in
+ // ResolverVisitor.visitSendSet.
+ if (op == '++') return const SourceString(r'+');
+ else return const SourceString(r'-');
}
// TODO(polux): handle sendset as expression

Powered by Google App Engine
This is Rietveld 408576698