1 package net.sourceforge.phpdt.internal.compiler.ast;
4 import java.util.ArrayList;
8 * it could be list($v1,$v2), list(,$v2) ...
9 * @author Matthieu Casanova
11 public class ListExpression extends Expression {
13 public Expression[] vars;
14 public Expression expression;
16 public ListExpression(final Expression[] vars,
17 final Expression expression,
18 final int sourceStart,
19 final int sourceEnd) {
20 super(sourceStart, sourceEnd);
22 this.expression = expression;
25 public ListExpression(final Expression[] vars,
26 final int sourceStart,
27 final int sourceEnd) {
28 super(sourceStart, sourceEnd);
33 * Return the expression as String.
34 * @return the expression
36 public String toStringExpression() {
37 final StringBuffer buff = new StringBuffer("list(");
38 for (int i = 0; i < vars.length; i++) {
42 if (vars[i] != null) {
43 buff.append(vars[i].toStringExpression());
46 if (expression != null) {
48 buff.append(expression.toStringExpression());
50 return buff.toString();
54 * Get the variables from outside (parameters, globals ...)
56 public void getOutsideVariable(final List list) {
60 * get the modified variables.
62 public void getModifiedVariable(final List list) {
63 for (int i = 0; i < vars.length; i++) {
64 if (vars[i] != null) {
65 vars[i].getUsedVariable(list);
68 if (expression != null) {
69 expression.getModifiedVariable(list);
74 * Get the variables used.
76 public void getUsedVariable(final List list) {
77 if (expression != null) {
78 expression.getUsedVariable(list);