X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FunctionCall.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FunctionCall.java index 4aee466..333e918 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FunctionCall.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FunctionCall.java @@ -1,17 +1,24 @@ package net.sourceforge.phpdt.internal.compiler.ast; +import java.util.List; +import java.util.ArrayList; + /** + * A Function call. * @author Matthieu Casanova */ public class FunctionCall extends AbstractSuffixExpression { + /** the function name. */ public Expression prefix; - public ArgumentDeclaration[] args; - public FunctionCall(Expression prefix, - ArgumentDeclaration[] args, - int sourceEnd) { - super(prefix.sourceStart, sourceEnd); + /** the arguments. */ + public Expression[] args; + + public FunctionCall(final Expression prefix, + final Expression[] args, + final int sourceEnd) { + super(prefix.getSourceStart(), sourceEnd); this.prefix = prefix; this.args = args; } @@ -23,14 +30,53 @@ public class FunctionCall extends AbstractSuffixExpression { public String toStringExpression() { final StringBuffer buff = new StringBuffer(prefix.toStringExpression()); buff.append('('); - for (int i = 0; i < args.length; i++) { - ArgumentDeclaration arg = args[i]; - if (i != 0) { - buff.append(','); + if (args != null) { + for (int i = 0; i < args.length; i++) { + final Expression arg = args[i]; + if (i != 0) { + buff.append(','); + } + buff.append(arg.toStringExpression()); } - buff.append(arg); } buff.append(')'); return buff.toString(); } + + /** + * Get the variables from outside (parameters, globals ...) + * @return the variables from outside + */ + public List getOutsideVariable() { + return new ArrayList(1); + } + + /** + * get the modified variables. + * @return the variables from we change value + */ + public List getModifiedVariable() { + if (args == null) { + return new ArrayList(1); + } + final ArrayList list = new ArrayList(); + for (int i = 0; i < args.length; i++) { + list.addAll(args[i].getModifiedVariable()); + } + return list; + } + + /** + * Get the variables used. + * @return the variables used + */ + public List getUsedVariable() { + final List list = prefix.getUsedVariable(); + if (args != null) { + for (int i = 0; i < args.length; i++) { + list.addAll(args[i].getUsedVariable()); + } + } + return list; + } }