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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 accept(NodeVisitor visitor) => visitor.visitBlock(this); | 237 accept(NodeVisitor visitor) => visitor.visitBlock(this); |
238 void visitChildren(NodeVisitor visitor) { | 238 void visitChildren(NodeVisitor visitor) { |
239 for (Statement statement in statements) statement.accept(visitor); | 239 for (Statement statement in statements) statement.accept(visitor); |
240 } | 240 } |
241 Block _clone() => new Block(statements); | 241 Block _clone() => new Block(statements); |
242 } | 242 } |
243 | 243 |
244 class ExpressionStatement extends Statement { | 244 class ExpressionStatement extends Statement { |
245 final Expression expression; | 245 final Expression expression; |
246 ExpressionStatement(this.expression); | 246 ExpressionStatement(this.expression) { |
| 247 assert(this.expression != null); |
| 248 } |
247 | 249 |
248 accept(NodeVisitor visitor) => visitor.visitExpressionStatement(this); | 250 accept(NodeVisitor visitor) => visitor.visitExpressionStatement(this); |
249 void visitChildren(NodeVisitor visitor) { expression.accept(visitor); } | 251 void visitChildren(NodeVisitor visitor) { expression.accept(visitor); } |
250 ExpressionStatement _clone() => new ExpressionStatement(expression); | 252 ExpressionStatement _clone() => new ExpressionStatement(expression); |
251 } | 253 } |
252 | 254 |
253 class EmptyStatement extends Statement { | 255 class EmptyStatement extends Statement { |
254 EmptyStatement(); | 256 EmptyStatement(); |
255 | 257 |
256 accept(NodeVisitor visitor) => visitor.visitEmptyStatement(this); | 258 accept(NodeVisitor visitor) => visitor.visitEmptyStatement(this); |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 class Comment extends Statement { | 1172 class Comment extends Statement { |
1171 final String comment; | 1173 final String comment; |
1172 | 1174 |
1173 Comment(this.comment); | 1175 Comment(this.comment); |
1174 | 1176 |
1175 accept(NodeVisitor visitor) => visitor.visitComment(this); | 1177 accept(NodeVisitor visitor) => visitor.visitComment(this); |
1176 Comment _clone() => new Comment(comment); | 1178 Comment _clone() => new Comment(comment); |
1177 | 1179 |
1178 void visitChildren(NodeVisitor visitor) {} | 1180 void visitChildren(NodeVisitor visitor) {} |
1179 } | 1181 } |
OLD | NEW |