1 package net.sourceforge.phpdt.internal.compiler.ast;
3 import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
6 import java.util.ArrayList;
10 * it could be list($v1,$v2), list(,$v2) ...
11 * @author Matthieu Casanova
13 public class ListExpression extends Expression {
16 public Expression expression;
18 public ListExpression(final String[] vars,
19 final Expression expression,
20 final int sourceStart,
21 final int sourceEnd) {
22 super(sourceStart, sourceEnd);
24 this.expression = expression;
27 public ListExpression(final String[] vars,
28 final int sourceStart,
29 final int sourceEnd) {
30 super(sourceStart, sourceEnd);
35 * Return the expression as String.
36 * @return the expression
38 public String toStringExpression() {
39 final StringBuffer buff = new StringBuffer("list(");
40 for (int i = 0; i < vars.length; i++) {
41 final String var = vars[i];
49 if (expression != null) {
51 buff.append(expression.toStringExpression());
53 return buff.toString();
57 * Get the variables from outside (parameters, globals ...)
58 * @return the variables from outside
60 public List getOutsideVariable() {
61 return new ArrayList();
65 * get the modified variables.
66 * @return the variables from we change value
68 public List getModifiedVariable() {
69 final ArrayList list = new ArrayList();
70 for (int i = 0; i < vars.length; i++) {
71 list.add(new VariableUsage(vars[i],sourceStart));
73 if (expression != null) {
74 list.addAll(expression.getModifiedVariable());
80 * Get the variables used.
81 * @return the variables used
83 public List getUsedVariable() {
84 final ArrayList list = new ArrayList();
85 if (expression != null) {
86 list.addAll(expression.getUsedVariable());