OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 package com.google.dart.compiler.ast; | |
6 | |
7 /** | |
8 * Represents a Dart 'if' statement. | |
9 */ | |
10 public class DartIfStatement extends DartStatement { | |
11 | |
12 private DartExpression condition; | |
13 private DartStatement thenStmt; | |
14 private DartStatement elseStmt; | |
15 private final int closeParenOffset; | |
16 private final int elseTokenOffset; | |
17 | |
18 public DartIfStatement(DartExpression condition, int closeParenOffset, DartSta
tement thenStmt, | |
19 int elseTokenOffset, DartStatement elseStmt) { | |
20 this.condition = becomeParentOf(condition); | |
21 this.closeParenOffset = closeParenOffset; | |
22 this.thenStmt = becomeParentOf(thenStmt); | |
23 this.elseTokenOffset = elseTokenOffset; | |
24 this.elseStmt = becomeParentOf(elseStmt); | |
25 } | |
26 | |
27 public DartExpression getCondition() { | |
28 return condition; | |
29 } | |
30 | |
31 public int getCloseParenOffset() { | |
32 return closeParenOffset; | |
33 } | |
34 | |
35 public DartStatement getThenStatement() { | |
36 return thenStmt; | |
37 } | |
38 | |
39 public int getElseTokenOffset() { | |
40 return elseTokenOffset; | |
41 } | |
42 | |
43 public DartStatement getElseStatement() { | |
44 return elseStmt; | |
45 } | |
46 | |
47 @Override | |
48 public void visitChildren(ASTVisitor<?> visitor) { | |
49 safelyVisitChild(condition, visitor); | |
50 safelyVisitChild(thenStmt, visitor); | |
51 safelyVisitChild(elseStmt, visitor); | |
52 } | |
53 | |
54 @Override | |
55 public <R> R accept(ASTVisitor<R> visitor) { | |
56 return visitor.visitIfStatement(this); | |
57 } | |
58 } | |
OLD | NEW |