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 ...)
55 * @return the variables from outside
57 public List getOutsideVariable() {
58 return new ArrayList(1);
62 * get the modified variables.
63 * @return the variables from we change value
65 public List getModifiedVariable() {
66 final ArrayList list = new ArrayList();
67 for (int i = 0; i < vars.length; i++) {
68 list.addAll(vars[i].getUsedVariable());
70 if (expression != null) {
71 list.addAll(expression.getModifiedVariable());
77 * Get the variables used.
78 * @return the variables used
80 public List getUsedVariable() {
81 if (expression == null) {
82 return new ArrayList(1);
84 return expression.getUsedVariable();