package net.sourceforge.phpdt.internal.compiler.ast;
+import java.util.List;
+
/**
+ * A do statement.
* @author Matthieu Casanova
*/
public class DoStatement extends Statement {
/** The action of the while. (it could be a block) */
public Statement action;
- public DoStatement(Expression condition,
- Statement action,
- int sourceStart,
- int sourceEnd) {
+ public DoStatement(final Expression condition,
+ final Statement action,
+ final int sourceStart,
+ final int sourceEnd) {
super(sourceStart, sourceEnd);
this.condition = condition;
this.action = action;
* @param tab how many tabs (not used here
* @return a String
*/
- public String toString(int tab) {
+ public String toString(final int tab) {
final String s = tabString(tab);
- final StringBuffer buff = new StringBuffer("do "); //$NON-NLS-1$
+ final StringBuffer buff = new StringBuffer("do ");//$NON-NLS-1$
if (action == null) {
buff.append(" {} ;"); //$NON-NLS-1$
} else {
- buff.append("\n").append(action.toString(tab + 1)); //$NON-NLS-1$
+ buff.append("\n").append(action.toString(tab + 1));//$NON-NLS-1$
}
- buff.append(s).append(" while (");
- buff.append(condition.toStringExpression()).append(")"); //$NON-NLS-1$
+ buff.append(s).append(" while (");//$NON-NLS-1$
+ buff.append(condition.toStringExpression()).append(")");//$NON-NLS-1$
return buff.toString();
}
+
+ /**
+ * Get the variables from outside (parameters, globals ...)
+ */
+ public void getOutsideVariable(final List list) {
+ condition.getOutsideVariable(list); // todo: check if unuseful
+ action.getOutsideVariable(list);
+ }
+
+ /**
+ * get the modified variables.
+ */
+ public void getModifiedVariable(final List list) {
+ condition.getModifiedVariable(list);
+ action.getModifiedVariable(list);
+ }
+
+ /**
+ * Get the variables used.
+ */
+ public void getUsedVariable(final List list) {
+ condition.getUsedVariable(list);
+ action.getUsedVariable(list);
+ }
}