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 010 /** 011 * Represents the JavaScript break statement. 012 */ 013 public final class JsBreak extends JsContinue { 014 public JsBreak() { 015 super(null); 016 } 017 018 public JsBreak(JsNameRef label) { 019 super(label); 020 } 021 022 @Override 023 public void accept(JsVisitor v) { 024 v.visitBreak(this); 025 } 026 027 @Override 028 public void traverse(JsVisitorWithContext v, JsContext ctx) { 029 if (v.visit(this, ctx)) { 030 if (label != null){ 031 label = v.accept(label); 032 } 033 } 034 035 v.endVisit(this, ctx); 036 } 037 038 @NotNull 039 @Override 040 public JsBreak deepCopy() { 041 return new JsBreak(AstUtil.deepCopy(label)).withMetadataFrom(this); 042 } 043 }