| 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 package com.google.dart.compiler.ast; | 5 package com.google.dart.compiler.ast; |
| 6 | 6 |
| 7 import java.util.List; | 7 import java.util.List; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Represents a Dart 'switch' member ('case' or 'default'). | 10 * Represents a Dart 'switch' member ('case' or 'default'). |
| 11 */ | 11 */ |
| 12 public abstract class DartSwitchMember extends DartNode { | 12 public abstract class DartSwitchMember extends DartNode { |
| 13 | 13 |
| 14 private final NodeList<DartStatement> statements = NodeList.create(this); | 14 private final NodeList<DartStatement> statements = NodeList.create(this); |
| 15 private final DartLabel label; | 15 private final NodeList<DartLabel> labels = NodeList.create(this); |
| 16 | 16 |
| 17 public DartSwitchMember(DartLabel label, List<DartStatement> statements) { | 17 public DartSwitchMember(List<DartLabel> labels, List<DartStatement> statements
) { |
| 18 this.label = becomeParentOf(label); | 18 this.labels.addAll(labels); |
| 19 this.statements.addAll(statements); | 19 this.statements.addAll(statements); |
| 20 } | 20 } |
| 21 | 21 |
| 22 public List<DartStatement> getStatements() { | 22 public List<DartStatement> getStatements() { |
| 23 return statements; | 23 return statements; |
| 24 } | 24 } |
| 25 | 25 |
| 26 public DartLabel getLabel() { | 26 public List<DartLabel> getLabels() { |
| 27 return label; | 27 return labels; |
| 28 } | 28 } |
| 29 | 29 |
| 30 @Override | 30 @Override |
| 31 public void visitChildren(ASTVisitor<?> visitor) { | 31 public void visitChildren(ASTVisitor<?> visitor) { |
| 32 safelyVisitChild(label, visitor); | 32 labels.accept(visitor); |
| 33 statements.accept(visitor); | 33 statements.accept(visitor); |
| 34 } | 34 } |
| 35 } | 35 } |
| OLD | NEW |