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 com.google.dart.compiler.util.AstUtil;
008 import org.jetbrains.annotations.NotNull;
009 import org.jetbrains.annotations.Nullable;
010
011 public class JsContinue extends SourceInfoAwareJsNode implements JsStatement {
012 protected JsNameRef label;
013
014 public JsContinue() {
015 this(null);
016 }
017
018 public JsContinue(@Nullable JsNameRef label) {
019 super();
020 this.label = label;
021 }
022
023 public JsNameRef getLabel() {
024 return label;
025 }
026
027 @Override
028 public void accept(JsVisitor v) {
029 v.visitContinue(this);
030 }
031
032 @Override
033 public void acceptChildren(JsVisitor v) {
034 if (label != null){
035 v.accept(label);
036 }
037 }
038
039 @Override
040 public void traverse(JsVisitorWithContext v, JsContext ctx) {
041 if (v.visit(this, ctx)) {
042 if (label != null){
043 label = v.accept(label);
044 }
045 }
046
047 v.endVisit(this, ctx);
048 }
049
050 @NotNull
051 @Override
052 public JsContinue deepCopy() {
053 if (label == null) return new JsContinue();
054
055 return new JsContinue(AstUtil.deepCopy(label)).withMetadataFrom(this);
056 }
057 }