001 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
002 // for details. All rights reserved. Use of this source code is governed by a
003 // BSD-style license that can be found in the LICENSE file.
004
005 package com.google.dart.compiler.backend.js.ast;
006
007 import java.util.ArrayList;
008 import java.util.List;
009
010 /**
011 * A JavaScript switch statement.
012 */
013 public class JsSwitch extends SourceInfoAwareJsNode implements JsStatement {
014
015 private final List<JsSwitchMember> cases = new ArrayList<JsSwitchMember>();
016 private JsExpression expression;
017
018 public JsSwitch() {
019 super();
020 }
021
022 public List<JsSwitchMember> getCases() {
023 return cases;
024 }
025
026 public JsExpression getExpression() {
027 return expression;
028 }
029
030 public void setExpression(JsExpression expression) {
031 this.expression = expression;
032 }
033
034 @Override
035 public void accept(JsVisitor v) {
036 v.visit(this);
037 }
038
039 @Override
040 public void acceptChildren(JsVisitor visitor) {
041 visitor.accept(expression);
042 visitor.acceptWithInsertRemove(cases);
043 }
044 }