| 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 'if' statement. | 8 * Represents a Dart 'if' statement. |
| 9 */ | 9 */ |
| 10 public class DartIfStatement extends DartStatement { | 10 public class DartIfStatement extends DartStatement { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 public DartStatement getElseStatement() { | 26 public DartStatement getElseStatement() { |
| 27 return elseStmt; | 27 return elseStmt; |
| 28 } | 28 } |
| 29 | 29 |
| 30 public DartStatement getThenStatement() { | 30 public DartStatement getThenStatement() { |
| 31 return thenStmt; | 31 return thenStmt; |
| 32 } | 32 } |
| 33 | 33 |
| 34 @Override | 34 @Override |
| 35 public void traverse(DartVisitor v, DartContext ctx) { | 35 public void visitChildren(ASTVisitor<?> visitor) { |
| 36 if (v.visit(this, ctx)) { | |
| 37 condition = becomeParentOf(v.accept(condition)); | |
| 38 thenStmt = becomeParentOf(v.accept(thenStmt)); | |
| 39 if (elseStmt != null) { | |
| 40 elseStmt = becomeParentOf(v.accept(elseStmt)); | |
| 41 } | |
| 42 } | |
| 43 v.endVisit(this, ctx); | |
| 44 } | |
| 45 | |
| 46 @Override | |
| 47 public void visitChildren(DartPlainVisitor<?> visitor) { | |
| 48 condition.accept(visitor); | 36 condition.accept(visitor); |
| 49 thenStmt.accept(visitor); | 37 thenStmt.accept(visitor); |
| 50 if (elseStmt != null) { | 38 if (elseStmt != null) { |
| 51 elseStmt.accept(visitor); | 39 elseStmt.accept(visitor); |
| 52 } | 40 } |
| 53 } | 41 } |
| 54 | 42 |
| 55 @Override | 43 @Override |
| 56 public <R> R accept(DartPlainVisitor<R> visitor) { | 44 public <R> R accept(ASTVisitor<R> visitor) { |
| 57 return visitor.visitIfStatement(this); | 45 return visitor.visitIfStatement(this); |
| 58 } | 46 } |
| 59 } | 47 } |
| OLD | NEW |