| 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 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 template.accept(visitor); | 1252 template.accept(visitor); |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 TaggedTemplate _clone() => new TaggedTemplate(tag, template); | 1255 TaggedTemplate _clone() => new TaggedTemplate(tag, template); |
| 1256 | 1256 |
| 1257 int get precedenceLevel => CALL; | 1257 int get precedenceLevel => CALL; |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 // TODO(jmesserly): parser does not support this yet. | 1260 // TODO(jmesserly): parser does not support this yet. |
| 1261 class Yield extends Expression { | 1261 class Yield extends Expression { |
| 1262 final Expression value; | 1262 final Expression value; // Can be null. |
| 1263 | 1263 |
| 1264 /** | 1264 /** |
| 1265 * Whether this yield expression is a `yield*` that iterates each item in | 1265 * Whether this yield expression is a `yield*` that iterates each item in |
| 1266 * [value]. | 1266 * [value]. |
| 1267 */ | 1267 */ |
| 1268 final bool star; | 1268 final bool star; |
| 1269 | 1269 |
| 1270 Yield(this.value, {this.star: false}); | 1270 Yield(this.value, {this.star: false}); |
| 1271 | 1271 |
| 1272 accept(NodeVisitor visitor) => visitor.visitYield(this); | 1272 accept(NodeVisitor visitor) => visitor.visitYield(this); |
| 1273 | 1273 |
| 1274 void visitChildren(NodeVisitor visitor) { | 1274 void visitChildren(NodeVisitor visitor) { |
| 1275 value.accept(visitor); | 1275 if (value != null) value.accept(visitor); |
| 1276 } | 1276 } |
| 1277 | 1277 |
| 1278 Yield _clone() => new Yield(value); | 1278 Yield _clone() => new Yield(value); |
| 1279 | 1279 |
| 1280 int get precedenceLevel => YIELD; | 1280 int get precedenceLevel => YIELD; |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 class ClassDeclaration extends Statement { | 1283 class ClassDeclaration extends Statement { |
| 1284 final ClassExpression classExpr; | 1284 final ClassExpression classExpr; |
| 1285 | 1285 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 final Expression expression; | 1506 final Expression expression; |
| 1507 | 1507 |
| 1508 CommentExpression(this.comment, this.expression); | 1508 CommentExpression(this.comment, this.expression); |
| 1509 | 1509 |
| 1510 int get precedenceLevel => PRIMARY; | 1510 int get precedenceLevel => PRIMARY; |
| 1511 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); | 1511 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); |
| 1512 CommentExpression _clone() => new CommentExpression(comment, expression); | 1512 CommentExpression _clone() => new CommentExpression(comment, expression); |
| 1513 | 1513 |
| 1514 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); | 1514 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); |
| 1515 } | 1515 } |
| OLD | NEW |