| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 package com.google.dart.compiler.ast; | 5 package com.google.dart.compiler.ast; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Represents a Dart 'do/while' statement. | 8 * Represents a Dart 'do/while' statement. |
| 9 */ | 9 */ |
| 10 public class DartDoWhileStatement extends DartStatement { | 10 public class DartDoWhileStatement extends DartStatement { |
| 11 | 11 |
| 12 private DartExpression condition; | 12 private DartExpression condition; |
| 13 private DartStatement body; | 13 private DartStatement body; |
| 14 | 14 |
| 15 public DartDoWhileStatement(DartExpression condition, DartStatement body) { | 15 public DartDoWhileStatement(DartExpression condition, DartStatement body) { |
| 16 this.condition = becomeParentOf(condition); | 16 this.condition = becomeParentOf(condition); |
| 17 this.body = becomeParentOf(body); | 17 this.body = becomeParentOf(body); |
| 18 } | 18 } |
| 19 | 19 |
| 20 public DartStatement getBody() { | 20 public DartStatement getBody() { |
| 21 return body; | 21 return body; |
| 22 } | 22 } |
| 23 | 23 |
| 24 public DartExpression getCondition() { | 24 public DartExpression getCondition() { |
| 25 return condition; | 25 return condition; |
| 26 } | 26 } |
| 27 | 27 |
| 28 @Override | 28 @Override |
| 29 public void visitChildren(ASTVisitor<?> visitor) { | 29 public void visitChildren(ASTVisitor<?> visitor) { |
| 30 condition.accept(visitor); | 30 if (condition != null) { |
| 31 condition.accept(visitor); |
| 32 } |
| 31 body.accept(visitor); | 33 body.accept(visitor); |
| 32 } | 34 } |
| 33 | 35 |
| 34 @Override | 36 @Override |
| 35 public <R> R accept(ASTVisitor<R> visitor) { | 37 public <R> R accept(ASTVisitor<R> visitor) { |
| 36 return visitor.visitDoWhileStatement(this); | 38 return visitor.visitDoWhileStatement(this); |
| 37 } | 39 } |
| 38 } | 40 } |
| OLD | NEW |