1 package net.sourceforge.phpdt.internal.compiler.ast;
6 * @author Matthieu Casanova
8 public class ForeachStatement extends Statement {
10 public Expression expression;
11 public Expression variable;
12 public Statement statement;
14 public ForeachStatement(final Expression expression,
15 final Expression variable,
16 final Statement statement,
17 final int sourceStart,
18 final int sourceEnd) {
19 super(sourceStart, sourceEnd);
20 this.expression = expression;
21 this.variable = variable;
22 this.statement = statement;
26 * Return the object into String.
27 * @param tab how many tabs (not used here
30 public String toString(final int tab) {
31 final StringBuffer buff = new StringBuffer(tabString(tab));
32 buff.append("foreach (");
33 buff.append(expression.toStringExpression());
35 buff.append(variable.toStringExpression());
37 buff.append(statement.toString(tab+1));
39 return buff.toString();
43 * Get the variables from outside (parameters, globals ...)
45 public void getOutsideVariable(final List list) {
46 expression.getOutsideVariable(list);
47 variable.getOutsideVariable(list);
48 statement.getOutsideVariable(list);
52 * get the modified variables.
54 public void getModifiedVariable(final List list) {
55 expression.getModifiedVariable(list);
56 variable.getUsedVariable(list);
57 statement.getModifiedVariable(list);
61 * Get the variables used.
63 public void getUsedVariable(final List list) {
64 expression.getUsedVariable(list);
65 statement.getUsedVariable(list);