| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 void visitChildren(NodeVisitor visitor) {} | 269 void visitChildren(NodeVisitor visitor) {} |
| 270 EmptyStatement _clone() => new EmptyStatement(); | 270 EmptyStatement _clone() => new EmptyStatement(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 class If extends Statement { | 273 class If extends Statement { |
| 274 final Expression condition; | 274 final Expression condition; |
| 275 final Node then; | 275 final Node then; |
| 276 final Node otherwise; | 276 final Node otherwise; |
| 277 | 277 |
| 278 If(this.condition, this.then, this.otherwise); | 278 If(this.condition, this.then, this.otherwise); |
| 279 If.noElse(this.condition, this.then) : this.otherwise = new EmptyStatement(); | 279 If.noElse(this.condition, this.then) : this.otherwise = null; |
| 280 | 280 |
| 281 bool get hasElse => otherwise is !EmptyStatement; | 281 bool get hasElse => otherwise != null; |
| 282 | 282 |
| 283 accept(NodeVisitor visitor) => visitor.visitIf(this); | 283 accept(NodeVisitor visitor) => visitor.visitIf(this); |
| 284 | 284 |
| 285 void visitChildren(NodeVisitor visitor) { | 285 void visitChildren(NodeVisitor visitor) { |
| 286 condition.accept(visitor); | 286 condition.accept(visitor); |
| 287 then.accept(visitor); | 287 then.accept(visitor); |
| 288 otherwise.accept(visitor); | 288 if (otherwise != null) otherwise.accept(visitor); |
| 289 } | 289 } |
| 290 | 290 |
| 291 If _clone() => new If(condition, then, otherwise); | 291 If _clone() => new If(condition, then, otherwise); |
| 292 } | 292 } |
| 293 | 293 |
| 294 abstract class Loop extends Statement { | 294 abstract class Loop extends Statement { |
| 295 final Statement body; | 295 final Statement body; |
| 296 Loop(this.body); | 296 Loop(this.body); |
| 297 } | 297 } |
| 298 | 298 |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 final Expression expression; | 1340 final Expression expression; |
| 1341 | 1341 |
| 1342 CommentExpression(this.comment, this.expression); | 1342 CommentExpression(this.comment, this.expression); |
| 1343 | 1343 |
| 1344 int get precedenceLevel => PRIMARY; | 1344 int get precedenceLevel => PRIMARY; |
| 1345 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); | 1345 accept(NodeVisitor visitor) => visitor.visitCommentExpression(this); |
| 1346 CommentExpression _clone() => new CommentExpression(comment, expression); | 1346 CommentExpression _clone() => new CommentExpression(comment, expression); |
| 1347 | 1347 |
| 1348 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); | 1348 void visitChildren(NodeVisitor visitor) => expression.accept(visitor); |
| 1349 } | 1349 } |
| OLD | NEW |