1 package net.sourceforge.phpdt.internal.compiler.ast;
6 * an array initializer.
7 * array('a','b','c') or array('a' => 2,'b' = '3');
8 * @author Matthieu Casanova
10 public class ArrayInitializer extends Expression {
12 public ArrayVariableDeclaration[] vars;
14 public ArrayInitializer(final ArrayVariableDeclaration[] vars,
15 final int sourceStart,
16 final int sourceEnd) {
17 super(sourceStart, sourceEnd);
22 * Return the expression as String.
23 * @return the expression
25 public String toStringExpression() {
26 final StringBuffer buff = new StringBuffer("array(");
27 for (int i = 0; i < vars.length; i++) {
31 if (vars[i] != null) {
32 buff.append(vars[i].toStringExpression());
36 return buff.toString();
40 * Get the variables from outside (parameters, globals ...)
42 public void getOutsideVariable(final List list) {
46 * get the modified variables.
48 public void getModifiedVariable(final List list) {
49 for (int i = 0; i < vars.length; i++) {
50 if (vars[i] != null) {
51 vars[i].getModifiedVariable(list);
57 * Get the variables used.
59 public void getUsedVariable(final List list) {
60 for (int i = 0; i < vars.length; i++) {
61 if (vars[i] != null) {
62 vars[i].getUsedVariable(list);