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

Unified Diff: pkg/compiler/lib/src/resolution/semantic_visitor.dart

Issue 1120633002: Refactor index operator in SimpleTypeInferrer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix bug. Created 5 years, 8 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
Index: pkg/compiler/lib/src/resolution/semantic_visitor.dart
diff --git a/pkg/compiler/lib/src/resolution/semantic_visitor.dart b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
index b626bba589838d6e7b5293cbdb5e34faa5d858ed..ffa533bfeeb81717c06b82f5e348a90f4a4360da 100644
--- a/pkg/compiler/lib/src/resolution/semantic_visitor.dart
+++ b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
@@ -1223,6 +1223,22 @@ abstract class SemanticSendVisitor<R, A> {
Node argument,
A arg);
+ /// Binary operation on the unresolved super [element].
+ ///
+ /// For instance
+ /// class B {
+ /// }
+ /// class C extends B {
+ /// m() => super + 42;
+ /// }
+ ///
+ R visitUnresolvedSuperBinary(
+ Send node,
+ Element element,
+ BinaryOperator operator,
+ Node argument,
+ A arg);
+
/// Index expression `receiver[index]`.
///
/// For instance:
@@ -1277,6 +1293,20 @@ abstract class SemanticSendVisitor<R, A> {
Node index,
A arg);
+ /// Index expression `super[index]` where 'operator []' is unresolved.
+ ///
+ /// For instance:
+ /// class B {}
+ /// class C extends B {
+ /// m(a) => super[a];
+ /// }
+ ///
+ R visitUnresolvedSuperIndex(
+ Send node,
+ Element element,
+ Node index,
+ A arg);
+
/// Prefix operation on an index expression `operator super[index]` where
/// 'operator []' is implemented on a superclass by [indexFunction] and
/// 'operator []=' is implemented on by [indexSetFunction] and the operation
@@ -1293,8 +1323,8 @@ abstract class SemanticSendVisitor<R, A> {
///
R visitSuperIndexPrefix(
Send node,
- FunctionElement indexFunction,
- FunctionElement indexSetFunction,
+ MethodElement indexFunction,
+ MethodElement indexSetFunction,
Node index,
IncDecOperator operator,
A arg);
@@ -1315,29 +1345,49 @@ abstract class SemanticSendVisitor<R, A> {
///
R visitSuperIndexPostfix(
Send node,
- FunctionElement indexFunction,
- FunctionElement indexSetFunction,
+ MethodElement indexFunction,
+ MethodElement indexSetFunction,
Node index,
IncDecOperator operator,
A arg);
- /// Index expression `super[index]` where 'operator []' is unresolved.
+ /// Prefix operation on an index expression `operator super[index]` where
+ /// 'operator []' and maybe also 'operator []=' is unresolved and the
+ /// operation is defined by [operator].
///
/// For instance:
/// class B {}
/// class C extends B {
- /// m(a) => super[a];
+ /// m(a) => --super[a];
/// }
///
- R visitUnresolvedSuperIndex(
+ R visitUnresolvedSuperGetterIndexPrefix(
+ Send node,
+ Element element,
+ Node index,
+ IncDecOperator operator,
+ A arg);
+
+ /// Postfix operation on an index expression `super[index] operator` where
+ /// 'operator []' and maybe also 'operator []=' is unresolved and the
+ /// operation is defined by [operator].
+ ///
+ /// For instance:
+ /// class B {}
+ /// class C extends B {
+ /// m(a) => super[a]++;
+ /// }
+ ///
+ R visitUnresolvedSuperGetterIndexPostfix(
Send node,
Element element,
Node index,
+ IncDecOperator operator,
A arg);
/// Prefix operation on an index expression `operator super[index]` where
- /// 'operator []' or 'operator []=' is unresolved and the operation
- /// is defined by [operator].
+ /// 'operator []' is implemented on a superclass by [indexFunction] and
+ /// 'operator []=' is unresolved and the operation is defined by [operator].
///
/// For instance:
/// class B {}
@@ -1345,16 +1395,17 @@ abstract class SemanticSendVisitor<R, A> {
/// m(a) => --super[a];
/// }
///
- R errorUnresolvedSuperIndexPrefix(
+ R visitUnresolvedSuperSetterIndexPrefix(
Send node,
- Element function,
+ MethodElement indexFunction,
+ Element element,
Node index,
IncDecOperator operator,
A arg);
/// Postfix operation on an index expression `super[index] operator` where
- /// 'operator []' or 'operator []=' is unresolved and the operation
- /// is defined by [operator].
+ /// 'operator []' is implemented on a superclass by [indexFunction] and
+ /// 'operator []=' is unresolved and the operation is defined by [operator].
///
/// For instance:
/// class B {}
@@ -1362,9 +1413,10 @@ abstract class SemanticSendVisitor<R, A> {
/// m(a) => super[a]++;
/// }
///
- R errorUnresolvedSuperIndexPostfix(
+ R visitUnresolvedSuperSetterIndexPostfix(
Send node,
- Element function,
+ MethodElement indexFunction,
+ Element element,
Node index,
IncDecOperator operator,
A arg);
@@ -1455,6 +1507,21 @@ abstract class SemanticSendVisitor<R, A> {
FunctionElement function,
A arg);
+ /// Unary operation on the unresolved super [element].
+ ///
+ /// For instance
+ /// class B {
+ /// }
+ /// class C extends B {
+ /// m() => -super;
+ /// }
+ ///
+ R visitUnresolvedSuperUnary(
+ Send node,
+ UnaryOperator operator,
+ Element element,
+ A arg);
+
/// Unary expression `!expression`.
///
/// For instance:
@@ -1495,6 +1562,23 @@ abstract class SemanticSendVisitor<R, A> {
Node rhs,
A arg);
+ /// Index set expression `super[index] = rhs` where `operator []=` is
+ /// undefined.
+ ///
+ /// For instance
+ /// class B {
+ /// }
+ /// class C extends B {
+ /// m() => super[1] = 42;
+ /// }
+ ///
+ R visitUnresolvedSuperIndexSet(
+ Send node,
+ Element element,
+ Node index,
+ Node rhs,
+ A arg);
+
/// Logical and, &&, expression with operands [left] and [right].
///
/// For instance
@@ -1970,8 +2054,8 @@ abstract class SemanticSendVisitor<R, A> {
Node rhs,
A arg);
- /// Compound assignment expression of [rhs] with [operator] on the index
- /// operators of [receiver] whose getter and setter are defined by
+ /// Compound index assignment of [rhs] with [operator] to [index] on the
+ /// index operators of [receiver] whose getter and setter are defined by
/// [getterSelector] and [setterSelector], respectively.
///
/// For instance:
@@ -1985,7 +2069,7 @@ abstract class SemanticSendVisitor<R, A> {
Node rhs,
A arg);
- /// Compound assignment expression of [rhs] with [operator] on the index
+ /// Compound index assignment of [rhs] with [operator] to [index] on the index
/// operators of a super class defined by [getter] and [setter].
///
/// For instance:
@@ -1999,8 +2083,48 @@ abstract class SemanticSendVisitor<R, A> {
///
R visitSuperCompoundIndexSet(
SendSet node,
- FunctionElement getter,
- FunctionElement setter,
+ MethodElement getter,
+ MethodElement setter,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg);
+
+ /// Compound index assignment of [rhs] with [operator] to [index] on a super
+ /// super class where the index getter is undefined. The index setter might
+ /// also be undefined.
+ ///
+ /// For instance
+ /// class B {
+ /// }
+ /// class C extends B {
+ /// m() => super[1] += 42;
+ /// }
+ ///
+ R visitUnresolvedSuperGetterCompoundIndexSet(
+ Send node,
+ Element element,
+ Node index,
+ AssignmentOperator operator,
+ Node rhs,
+ A arg);
+
+ /// Compound index assignment of [rhs] with [operator] to [index] on a super
+ /// super class where the index getter is defined by [getter] but the index
+ /// setter is undefined.
+ ///
+ /// For instance
+ /// class B {
+ /// operator [](index) => 42;
+ /// }
+ /// class C extends B {
+ /// m() => super[1] += 42;
+ /// }
+ ///
+ R visitUnresolvedSuperSetterCompoundIndexSet(
+ Send node,
+ MethodElement getter,
+ Element element,
Node index,
AssignmentOperator operator,
Node rhs,
@@ -2842,71 +2966,6 @@ abstract class SemanticSendVisitor<R, A> {
IncDecOperator operator,
A arg);
- /// Index set operation on the unresolved super [element].
- ///
- /// For instance
- /// class B {
- /// }
- /// class C extends B {
- /// m() => super[1] = 42;
- /// }
- ///
- R errorUnresolvedSuperIndexSet(
- Send node,
- Element element,
- Node index,
- Node rhs,
- A arg);
-
- /// Compound index set operation on the unresolved super [element].
- ///
- /// For instance
- /// class B {
- /// }
- /// class C extends B {
- /// m() => super[1] += 42;
- /// }
- ///
- // TODO(johnniwinther): Split this case into unresolved getter/setter cases.
- R errorUnresolvedSuperCompoundIndexSet(
- Send node,
- Element element,
- Node index,
- AssignmentOperator operator,
- Node rhs,
- A arg);
-
- /// Unary operation on the unresolved super [element].
- ///
- /// For instance
- /// class B {
- /// }
- /// class C extends B {
- /// m() => -super;
- /// }
- ///
- R visitUnresolvedSuperUnary(
- Send node,
- UnaryOperator operator,
- Element element,
- A arg);
-
- /// Binary operation on the unresolved super [element].
- ///
- /// For instance
- /// class B {
- /// }
- /// class C extends B {
- /// m() => super + 42;
- /// }
- ///
- R visitUnresolvedSuperBinary(
- Send node,
- Element element,
- BinaryOperator operator,
- Node argument,
- A arg);
-
/// Invocation of an undefined unary [operator] on [expression].
R errorUndefinedUnaryExpression(
Send node,

Powered by Google App Engine
This is Rietveld 408576698