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

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

Issue 1004683002: Refactor IrBuilder to use SemanticVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Handle local/static constants and index prefix/postfix. Created 5 years, 9 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 6e0ea3154ae771ef3b47402468cf2bbed6951cd7..7e259aac1cf308a9c05d823ea20dbfda0b43bd4c 100644
--- a/pkg/compiler/lib/src/resolution/semantic_visitor.dart
+++ b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
@@ -5,6 +5,7 @@
library dart2js.semantics_visitor;
import '../constants/expressions.dart';
+import '../dart2jslib.dart' show invariant;
import '../dart_types.dart';
import '../elements/elements.dart';
import '../tree/tree.dart';
@@ -57,6 +58,8 @@ abstract class SemanticVisitor<R, A> extends Visitor<R>
}
}
+// TODO(johnniwinther): Add visits for [visitLocalConstantGet],
+// [visitLocalConstantInvoke], [visitStaticConstantGet], etc.
abstract class SemanticSendVisitor<R, A> {
R apply(Node node, A arg);
@@ -1102,6 +1105,32 @@ abstract class SemanticSendVisitor<R, A> {
Node index,
A arg);
+ /// Prefix operation on an index expression `operator receiver[index]` where
+ /// the operation is defined by [operator].
+ ///
+ /// For instance:
+ /// lookup(a, b) => --a[b];
+ ///
+ R visitIndexPrefix(
+ Send node,
+ Node receiver,
+ Node index,
+ IncDecOperator operator,
+ A arg);
+
+ /// Postfix operation on an index expression `receiver[index] operator` where
+ /// the operation is defined by [operator].
+ ///
+ /// For instance:
+ /// lookup(a, b) => a[b]++;
+ ///
+ R visitIndexPostfix(
+ Send node,
+ Node receiver,
+ Node index,
+ IncDecOperator operator,
+ A arg);
+
/// Index expression `super[index]` where 'operator []' is implemented on a
/// superclass by [function].
///
@@ -1119,6 +1148,98 @@ abstract class SemanticSendVisitor<R, A> {
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
+ /// is defined by [operator].
+ ///
+ /// For instance:
+ /// class B {
+ /// operator [](_) => null;
+ /// operator []=(a, b) {}
+ /// }
+ /// class C extends B {
+ /// m(a) => --super[a];
+ /// }
+ ///
+ R visitSuperIndexPrefix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
+ A arg);
+
+ /// Postfix operation on an index expression `super[index] operator` where
+ /// 'operator []' is implemented on a superclass by [indexFunction] and
+ /// 'operator []=' is implemented on by [indexSetFunction] and the operation
+ /// is defined by [operator].
+ ///
+ /// For instance:
+ /// class B {
+ /// operator [](_) => null;
+ /// operator []=(a, b) {}
+ /// }
+ /// class C extends B {
+ /// m(a) => super[a]++;
+ /// }
+ ///
+ R visitSuperIndexPostfix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
+ A arg);
+
+ /// Index expression `super[index]` where 'operator []' is unresolved.
+ ///
+ /// For instance:
+ /// class B {}
+ /// class C extends B {
+ /// m(a) => super[a];
+ /// }
+ ///
+ R errorUnresolvedSuperIndex(
+ Send node,
+ Element element,
+ Node index,
+ A arg);
+
+ /// Prefix operation on an index expression `operator super[index]` where
+ /// 'operator []' or 'operator []=' is unresolved and the operation
+ /// is defined by [operator].
+ ///
+ /// For instance:
+ /// class B {}
+ /// class C extends B {
+ /// m(a) => --super[a];
+ /// }
+ ///
+ R errorUnresolvedSuperIndexPrefix(
+ Send node,
+ Element function,
+ 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].
+ ///
+ /// For instance:
+ /// class B {}
+ /// class C extends B {
+ /// m(a) => super[a]++;
+ /// }
+ ///
+ R errorUnresolvedSuperIndexPostfix(
+ Send node,
+ Element function,
+ Node index,
+ IncDecOperator operator,
+ A arg);
+
/// Binary expression `left == right`.
///
/// For instance:
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698