X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java index 5ac7c04..80f1887 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java @@ -1,6 +1,13 @@ package net.sourceforge.phpdt.internal.compiler.ast; +import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage; + +import java.util.List; +import java.util.ArrayList; + /** + * A list expression. + * it could be list($v1,$v2), list(,$v2) ... * @author Matthieu Casanova */ public class ListExpression extends Expression { @@ -8,12 +15,22 @@ public class ListExpression extends Expression { public String[] vars; public Expression expression; - public ListExpression(String[] vars, Expression expression, int sourceStart, int sourceEnd) { + public ListExpression(final String[] vars, + final Expression expression, + final int sourceStart, + final int sourceEnd) { super(sourceStart, sourceEnd); this.vars = vars; this.expression = expression; } + public ListExpression(final String[] vars, + final int sourceStart, + final int sourceEnd) { + super(sourceStart, sourceEnd); + this.vars = vars; + } + /** * Return the expression as String. * @return the expression @@ -21,12 +38,12 @@ public class ListExpression extends Expression { public String toStringExpression() { final StringBuffer buff = new StringBuffer("list("); for (int i = 0; i < vars.length; i++) { - String var = vars[i]; + final String var = vars[i]; if (i != 0) { buff.append(", "); } if (var != null) { - buff.append(vars); + buff.append(var); } } if (expression != null) { @@ -35,4 +52,39 @@ public class ListExpression extends Expression { } return buff.toString(); } + + /** + * Get the variables from outside (parameters, globals ...) + * @return the variables from outside + */ + public List getOutsideVariable() { + return new ArrayList(); + } + + /** + * get the modified variables. + * @return the variables from we change value + */ + public List getModifiedVariable() { + final ArrayList list = new ArrayList(); + for (int i = 0; i < vars.length; i++) { + list.add(new VariableUsage(vars[i],sourceStart)); + } + if (expression != null) { + list.addAll(expression.getModifiedVariable()); + } + return list; + } + + /** + * Get the variables used. + * @return the variables used + */ + public List getUsedVariable() { + final ArrayList list = new ArrayList(); + if (expression != null) { + list.addAll(expression.getUsedVariable()); + } + return list; + } }