| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 class Block extends Statement { | 279 class Block extends Statement { |
| 280 final List<Statement> statements; | 280 final List<Statement> statements; |
| 281 | 281 |
| 282 /// True to preserve this [Block] for scoping reasons. | 282 /// True to preserve this [Block] for scoping reasons. |
| 283 final bool isScope; | 283 final bool isScope; |
| 284 | 284 |
| 285 Block(this.statements, {this.isScope: false}) { | 285 Block(this.statements, {this.isScope: false}) { |
| 286 assert(!statements.any((s) => s is! Statement)); | 286 assert(!statements.any((s) => s is! Statement)); |
| 287 } | 287 } |
| 288 Block.empty() : this.statements = <Statement>[]; | 288 Block.empty() : statements = <Statement>[], isScope = false; |
| 289 | 289 |
| 290 accept(NodeVisitor visitor) => visitor.visitBlock(this); | 290 accept(NodeVisitor visitor) => visitor.visitBlock(this); |
| 291 void visitChildren(NodeVisitor visitor) { | 291 void visitChildren(NodeVisitor visitor) { |
| 292 for (Statement statement in statements) statement.accept(visitor); | 292 for (Statement statement in statements) statement.accept(visitor); |
| 293 } | 293 } |
| 294 Block _clone() => new Block(statements); | 294 Block _clone() => new Block(statements); |
| 295 } | 295 } |
| 296 | 296 |
| 297 class ExpressionStatement extends Statement { | 297 class ExpressionStatement extends Statement { |
| 298 final Expression expression; | 298 final Expression expression; |
| (...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 final Expression expression; | 1567 final Expression expression; |
| 1568 | 1568 |
| 1569 CommentExpression(this.comment, this.expression); | 1569 CommentExpression(this.comment, this.expression); |
| 1570 | 1570 |
| 1571 int get precedenceLevel => PRIMARY; | 1571 int get precedenceLevel => PRIMARY; |
| 1572 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); | 1572 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); |
| 1573 CommentExpression _clone() => new CommentExpression(comment, expression); | 1573 CommentExpression _clone() => new CommentExpression(comment, expression); |
| 1574 | 1574 |
| 1575 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); | 1575 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); |
| 1576 } | 1576 } |
| OLD | NEW |