package net.sourceforge.phpdt.internal.compiler.ast;
+import java.util.List;
+
/**
+ * an array initializer.
+ * array('a','b','c') or array('a' => 2,'b' = '3');
* @author Matthieu Casanova
*/
public class ArrayInitializer extends Expression {
public ArrayVariableDeclaration[] vars;
- public ArrayInitializer(ArrayVariableDeclaration[] vars,
- int sourceStart,
- int sourceEnd) {
+ public ArrayInitializer(final ArrayVariableDeclaration[] vars,
+ final int sourceStart,
+ final int sourceEnd) {
super(sourceStart, sourceEnd);
this.vars = vars;
}
public String toStringExpression() {
final StringBuffer buff = new StringBuffer("array(");
for (int i = 0; i < vars.length; i++) {
- ArrayVariableDeclaration var = vars[i];
if (i != 0) {
buff.append(",");
}
- buff.append(var.toStringExpression());
+ if (vars[i] != null) {
+ buff.append(vars[i].toStringExpression());
+ }
}
buff.append(")");
return buff.toString();
}
+
+ /**
+ * Get the variables from outside (parameters, globals ...)
+ */
+ public void getOutsideVariable(final List list) {
+ }
+
+ /**
+ * get the modified variables.
+ */
+ public void getModifiedVariable(final List list) {
+ for (int i = 0; i < vars.length; i++) {
+ if (vars[i] != null) {
+ vars[i].getModifiedVariable(list);
+ }
+ }
+ }
+
+ /**
+ * Get the variables used.
+ */
+ public void getUsedVariable(final List list) {
+ for (int i = 0; i < vars.length; i++) {
+ if (vars[i] != null) {
+ vars[i].getUsedVariable(list);
+ }
+ }
+ }
}