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 public class JsThrow extends SourceInfoAwareJsNode implements JsStatement { 011 private JsExpression expression; 012 013 public JsThrow() { 014 } 015 016 public JsThrow(JsExpression expression) { 017 this.expression = expression; 018 } 019 020 public JsExpression getExpression() { 021 return expression; 022 } 023 024 public void setExpression(JsExpression expression) { 025 this.expression = expression; 026 } 027 028 @Override 029 public void accept(JsVisitor v) { 030 v.visitThrow(this); 031 } 032 033 @Override 034 public void acceptChildren(JsVisitor visitor) { 035 visitor.accept(expression); 036 } 037 038 @Override 039 public void traverse(JsVisitorWithContext v, JsContext ctx) { 040 if (v.visit(this, ctx)) { 041 expression = v.accept(expression); 042 } 043 v.endVisit(this, ctx); 044 } 045 046 @NotNull 047 @Override 048 public JsThrow deepCopy() { 049 return new JsThrow(AstUtil.deepCopy(expression)).withMetadataFrom(this); 050 } 051 }