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 <code>while</code> statement.
009 */
010 public class JsWhile extends SourceInfoAwareJsNode implements JsStatement {
011 protected JsStatement body;
012 protected JsExpression condition;
013
014 public JsWhile() {
015 }
016
017 public JsWhile(JsExpression condition, JsStatement body) {
018 this.condition = condition;
019 this.body = body;
020 }
021
022 public JsStatement getBody() {
023 return body;
024 }
025
026 public JsExpression getCondition() {
027 return condition;
028 }
029
030 public void setBody(JsStatement body) {
031 this.body = body;
032 }
033
034 public void setCondition(JsExpression condition) {
035 this.condition = condition;
036 }
037
038 @Override
039 public void accept(JsVisitor v) {
040 v.visitWhile(this);
041 }
042
043 @Override
044 public void acceptChildren(JsVisitor visitor) {
045 visitor.accept(condition);
046 visitor.accept(body);
047 }
048 }