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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 class EmptyStatement extends Statement { | 253 class EmptyStatement extends Statement { |
254 EmptyStatement(); | 254 EmptyStatement(); |
255 | 255 |
256 accept(NodeVisitor visitor) => visitor.visitEmptyStatement(this); | 256 accept(NodeVisitor visitor) => visitor.visitEmptyStatement(this); |
257 void visitChildren(NodeVisitor visitor) {} | 257 void visitChildren(NodeVisitor visitor) {} |
258 EmptyStatement _clone() => new EmptyStatement(); | 258 EmptyStatement _clone() => new EmptyStatement(); |
259 } | 259 } |
260 | 260 |
261 class If extends Statement { | 261 class If extends Statement { |
262 final Expression condition; | 262 final Expression condition; |
263 final Node then; | 263 final Statement then; |
264 final Node otherwise; | 264 final Statement otherwise; |
265 | 265 |
266 If(this.condition, this.then, this.otherwise); | 266 If(this.condition, this.then, this.otherwise); |
267 If.noElse(this.condition, this.then) : this.otherwise = new EmptyStatement(); | 267 If.noElse(this.condition, this.then) : this.otherwise = new EmptyStatement(); |
268 | 268 |
269 bool get hasElse => otherwise is !EmptyStatement; | 269 bool get hasElse => otherwise is !EmptyStatement; |
270 | 270 |
271 accept(NodeVisitor visitor) => visitor.visitIf(this); | 271 accept(NodeVisitor visitor) => visitor.visitIf(this); |
272 | 272 |
273 void visitChildren(NodeVisitor visitor) { | 273 void visitChildren(NodeVisitor visitor) { |
274 condition.accept(visitor); | 274 condition.accept(visitor); |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 class Comment extends Statement { | 1167 class Comment extends Statement { |
1168 final String comment; | 1168 final String comment; |
1169 | 1169 |
1170 Comment(this.comment); | 1170 Comment(this.comment); |
1171 | 1171 |
1172 accept(NodeVisitor visitor) => visitor.visitComment(this); | 1172 accept(NodeVisitor visitor) => visitor.visitComment(this); |
1173 Comment _clone() => new Comment(comment); | 1173 Comment _clone() => new Comment(comment); |
1174 | 1174 |
1175 void visitChildren(NodeVisitor visitor) {} | 1175 void visitChildren(NodeVisitor visitor) {} |
1176 } | 1176 } |
OLD | NEW |