1 package net.sourceforge.phpdt.internal.compiler.ast;
7 * @author Matthieu Casanova
9 public class DoStatement extends Statement {
12 /** The condition expression. */
13 public Expression condition;
14 /** The action of the while. (it could be a block) */
15 public Statement action;
17 public DoStatement(final Expression condition,
18 final Statement action,
19 final int sourceStart,
20 final int sourceEnd) {
21 super(sourceStart, sourceEnd);
22 this.condition = condition;
27 * Return the object into String.
28 * @param tab how many tabs (not used here
31 public String toString(final int tab) {
32 final String s = tabString(tab);
33 final StringBuffer buff = new StringBuffer("do ");//$NON-NLS-1$
35 buff.append(" {} ;"); //$NON-NLS-1$
37 buff.append("\n").append(action.toString(tab + 1));//$NON-NLS-1$
39 buff.append(s).append(" while (");//$NON-NLS-1$
40 buff.append(condition.toStringExpression()).append(")");//$NON-NLS-1$
41 return buff.toString();
45 * Get the variables from outside (parameters, globals ...)
47 public void getOutsideVariable(final List list) {
48 condition.getOutsideVariable(list); // todo: check if unuseful
49 action.getOutsideVariable(list);
53 * get the modified variables.
55 public void getModifiedVariable(final List list) {
56 condition.getModifiedVariable(list);
57 action.getModifiedVariable(list);
61 * Get the variables used.
63 public void getUsedVariable(final List list) {
64 condition.getUsedVariable(list);
65 action.getUsedVariable(list);