1 package net.sourceforge.phpdt.internal.compiler.ast;
4 import java.util.ArrayList;
8 * @author Matthieu Casanova
10 public class DoStatement extends Statement {
13 /** The condition expression. */
14 public Expression condition;
15 /** The action of the while. (it could be a block) */
16 public Statement action;
18 public DoStatement(final Expression condition,
19 final Statement action,
20 final int sourceStart,
21 final int sourceEnd) {
22 super(sourceStart, sourceEnd);
23 this.condition = condition;
28 * Return the object into String.
29 * @param tab how many tabs (not used here
32 public String toString(final int tab) {
33 final String s = tabString(tab);
34 final StringBuffer buff = new StringBuffer("do ");//$NON-NLS-1$
36 buff.append(" {} ;"); //$NON-NLS-1$
38 buff.append("\n").append(action.toString(tab + 1));//$NON-NLS-1$
40 buff.append(s).append(" while (");//$NON-NLS-1$
41 buff.append(condition.toStringExpression()).append(")");//$NON-NLS-1$
42 return buff.toString();
46 * Get the variables from outside (parameters, globals ...)
48 public void getOutsideVariable(final List list) {
49 condition.getOutsideVariable(list); // todo: check if unuseful
50 action.getOutsideVariable(list);
54 * get the modified variables.
56 public void getModifiedVariable(final List list) {
57 condition.getModifiedVariable(list);
58 action.getModifiedVariable(list);
62 * Get the variables used.
64 public void getUsedVariable(final List list) {
65 condition.getUsedVariable(list);
66 action.getUsedVariable(list);