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 /**
008 * A JavaScript return statement.
009 */
010 public final class JsReturn extends SourceInfoAwareJsNode implements JsStatement {
011 private JsExpression expression;
012
013 public JsReturn() {
014 }
015
016 public JsReturn(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.visitReturn(this);
031 }
032
033 @Override
034 public void acceptChildren(JsVisitor visitor) {
035 if (expression != null) {
036 visitor.accept(expression);
037 }
038 }
039 }