OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of js_ast; | 5 part of js_ast; |
6 | 6 |
7 abstract class NodeVisitor<T> { | 7 abstract class NodeVisitor<T> { |
8 T visitProgram(Program node); | 8 T visitProgram(Program node); |
9 | 9 |
10 T visitBlock(Block node); | 10 T visitBlock(Block node); |
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 template.accept(visitor); | 1275 template.accept(visitor); |
1276 } | 1276 } |
1277 | 1277 |
1278 TaggedTemplate _clone() => new TaggedTemplate(tag, template); | 1278 TaggedTemplate _clone() => new TaggedTemplate(tag, template); |
1279 | 1279 |
1280 int get precedenceLevel => CALL; | 1280 int get precedenceLevel => CALL; |
1281 } | 1281 } |
1282 | 1282 |
1283 // TODO(jmesserly): parser does not support this yet. | 1283 // TODO(jmesserly): parser does not support this yet. |
1284 class Yield extends Expression { | 1284 class Yield extends Expression { |
1285 final Expression value; | 1285 final Expression value; // Can be null. |
1286 | 1286 |
1287 /** | 1287 /** |
1288 * Whether this yield expression is a `yield*` that iterates each item in | 1288 * Whether this yield expression is a `yield*` that iterates each item in |
1289 * [value]. | 1289 * [value]. |
1290 */ | 1290 */ |
1291 final bool star; | 1291 final bool star; |
1292 | 1292 |
1293 Yield(this.value, {this.star: false}); | 1293 Yield(this.value, {this.star: false}); |
1294 | 1294 |
1295 accept(NodeVisitor visitor) => visitor.visitYield(this); | 1295 accept(NodeVisitor visitor) => visitor.visitYield(this); |
1296 | 1296 |
1297 void visitChildren(NodeVisitor visitor) { | 1297 void visitChildren(NodeVisitor visitor) { |
1298 value.accept(visitor); | 1298 if (value != null) value.accept(visitor); |
1299 } | 1299 } |
1300 | 1300 |
1301 Yield _clone() => new Yield(value); | 1301 Yield _clone() => new Yield(value); |
1302 | 1302 |
1303 int get precedenceLevel => YIELD; | 1303 int get precedenceLevel => YIELD; |
1304 } | 1304 } |
1305 | 1305 |
1306 class ClassDeclaration extends Statement { | 1306 class ClassDeclaration extends Statement { |
1307 final ClassExpression classExpr; | 1307 final ClassExpression classExpr; |
1308 | 1308 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 final Expression expression; | 1529 final Expression expression; |
1530 | 1530 |
1531 CommentExpression(this.comment, this.expression); | 1531 CommentExpression(this.comment, this.expression); |
1532 | 1532 |
1533 int get precedenceLevel => PRIMARY; | 1533 int get precedenceLevel => PRIMARY; |
1534 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); | 1534 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); |
1535 CommentExpression _clone() => new CommentExpression(comment, expression); | 1535 CommentExpression _clone() => new CommentExpression(comment, expression); |
1536 | 1536 |
1537 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); | 1537 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); |
1538 } | 1538 } |
OLD | NEW |