package net.sourceforge.phpdt.internal.compiler.ast;
import java.util.List;
-import java.util.ArrayList;
/**
* A Block.
* }.
* @author Matthieu Casanova
*/
-public class Block extends Statement {
+public final class Block extends Statement {
/** An array of statements inside the block. */
- public Statement[] statements;
+ public final Statement[] statements;
/**
* Create a block.
final String s = AstNode.tabString(tab);
final StringBuffer buff = new StringBuffer(s);
buff.append("{\n"); //$NON-NLS-1$
- if (this.statements != null) {
+ if (statements != null) {
for (int i = 0; i < statements.length; i++) {
buff.append(statements[i].toString(tab + 1)).append(";\n");//$NON-NLS-1$
}
/**
* Get the variables from outside (parameters, globals ...)
- * @return the variables from outside
+ *
+ * @param list the list where we will put variables
*/
- public List getOutsideVariable() {
- final ArrayList list = new ArrayList();
+ public void getOutsideVariable(final List list) {
for (int i = 0; i < statements.length; i++) {
- list.addAll(statements[i].getOutsideVariable());
+ statements[i].getOutsideVariable(list);
}
- return list;
}
/**
* get the modified variables.
- * @return the variables from we change value
+ *
+ * @param list the list where we will put variables
*/
- public List getModifiedVariable() {
- final ArrayList list = new ArrayList();
+ public void getModifiedVariable(final List list) {
for (int i = 0; i < statements.length; i++) {
- list.addAll(statements[i].getModifiedVariable());
+ statements[i].getModifiedVariable(list);
}
- return list;
}
/**
* Get the variables used.
- * @return the variables used
+ *
+ * @param list the list where we will put variables
*/
- public List getUsedVariable() {
- final ArrayList list = new ArrayList();
+ public void getUsedVariable(final List list) {
for (int i = 0; i < statements.length; i++) {
- list.addAll(statements[i].getUsedVariable());
+ statements[i].getUsedVariable(list);
}
- return list;
}
}