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

Unified Diff: pkg/compiler/lib/src/tree/nodes.dart

Issue 1077093002: Revert "Model 'await for' as an explicit node in tree and fix its handling." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | pkg/compiler/lib/src/tree/prettyprint.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/tree/nodes.dart
diff --git a/pkg/compiler/lib/src/tree/nodes.dart b/pkg/compiler/lib/src/tree/nodes.dart
index d6222eb6c3a6bdb2e69186ad46c3bad97758cbc7..2c22466f0d5777684a15a4c0220c9592e511ac5c 100644
--- a/pkg/compiler/lib/src/tree/nodes.dart
+++ b/pkg/compiler/lib/src/tree/nodes.dart
@@ -9,7 +9,6 @@ abstract class Visitor<R> {
R visitNode(Node node);
- R visitAsyncForIn(AsyncForIn node) => visitLoop(node);
R visitAsyncModifier(AsyncModifier node) => visitNode(node);
R visitAwait(Await node) => visitExpression(node);
R visitBlock(Block node) => visitStatement(node);
@@ -29,6 +28,7 @@ abstract class Visitor<R> {
R visitExpression(Expression node) => visitNode(node);
R visitExpressionStatement(ExpressionStatement node) => visitStatement(node);
R visitFor(For node) => visitLoop(node);
+ R visitForIn(ForIn node) => visitLoop(node);
R visitFunctionDeclaration(FunctionDeclaration node) => visitStatement(node);
R visitFunctionExpression(FunctionExpression node) => visitExpression(node);
R visitGotoStatement(GotoStatement node) => visitStatement(node);
@@ -50,7 +50,6 @@ abstract class Visitor<R> {
R visitLiteralNull(LiteralNull node) => visitLiteral(node);
R visitLiteralString(LiteralString node) => visitStringNode(node);
R visitStringJuxtaposition(StringJuxtaposition node) => visitStringNode(node);
- R visitSyncForIn(SyncForIn node) => visitLoop(node);
R visitLoop(Loop node) => visitStatement(node);
R visitMetadata(Metadata node) => visitNode(node);
R visitMixinApplication(MixinApplication node) => visitNode(node);
@@ -166,8 +165,6 @@ abstract class Node extends NullTreeElementMixin implements Spannable {
Expression asExpression() => null;
ExpressionStatement asExpressionStatement() => null;
For asFor() => null;
- SyncForIn asSyncForIn() => null;
- AsyncForIn asAsyncForIn() => null;
ForIn asForIn() => null;
FunctionDeclaration asFunctionDeclaration() => null;
FunctionExpression asFunctionExpression() => null;
@@ -1778,31 +1775,25 @@ class ContinueStatement extends GotoStatement {
accept(Visitor visitor) => visitor.visitContinueStatement(this);
}
-abstract class ForIn extends Loop {
+class ForIn extends Loop with StoredTreeElementMixin {
final Node declaredIdentifier;
final Expression expression;
+ final Token awaitToken;
final Token forToken;
final Token inToken;
ForIn(this.declaredIdentifier, this.expression,
- Statement body, this.forToken, this.inToken)
+ Statement body, this.awaitToken, this.forToken, this.inToken)
: super(body);
+ bool get isAsync => awaitToken != null;
+
Expression get condition => null;
ForIn asForIn() => this;
- Token getEndToken() => body.getEndToken();
-}
-
-class SyncForIn extends ForIn with StoredTreeElementMixin {
- SyncForIn(declaredIdentifier, expression, Statement body, forToken, inToken)
- : super(declaredIdentifier, expression, body, forToken, inToken);
-
- SyncForIn asSyncForIn() => this;
-
- accept(Visitor visitor) => visitor.visitSyncForIn(this);
+ accept(Visitor visitor) => visitor.visitForIn(this);
visitChildren(Visitor visitor) {
declaredIdentifier.accept(visitor);
@@ -1810,27 +1801,9 @@ class SyncForIn extends ForIn with StoredTreeElementMixin {
body.accept(visitor);
}
- Token getBeginToken() => forToken;
-}
-
-class AsyncForIn extends ForIn with StoredTreeElementMixin {
- final Token awaitToken;
-
- AsyncForIn(declaredIdentifier, expression,
- Statement body, this.awaitToken, forToken, inToken)
- : super(declaredIdentifier, expression, body, forToken, inToken);
-
- AsyncForIn asAsyncForIn() => this;
-
- accept(Visitor visitor) => visitor.visitAsyncForIn(this);
+ Token getBeginToken() => awaitToken != null ? awaitToken : forToken;
- visitChildren(Visitor visitor) {
- declaredIdentifier.accept(visitor);
- expression.accept(visitor);
- body.accept(visitor);
- }
-
- Token getBeginToken() => awaitToken;
+ Token getEndToken() => body.getEndToken();
}
class Label extends Node {
« no previous file with comments | « pkg/compiler/lib/src/ssa/nodes.dart ('k') | pkg/compiler/lib/src/tree/prettyprint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698