X-Git-Url: http://secure.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 cb0b5dd..d897240 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,21 +1,31 @@ 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 { +public final class FunctionCall extends AbstractSuffixExpression { - public Expression prefix; - public Expression[] args; + /** the function name. */ + private final Expression functionName; - public FunctionCall(final Expression prefix, + /** the arguments. */ + private final Expression[] args; + + /** + * a function call. + * it's functionName(args ...) + * @param functionName the function name + * @param args the arguments + * @param sourceEnd the source end + */ + public FunctionCall(final Expression functionName, final Expression[] args, final int sourceEnd) { - super(prefix.sourceStart, sourceEnd); - this.prefix = prefix; + super(functionName.sourceStart, sourceEnd); + this.functionName = functionName; this.args = args; } @@ -24,7 +34,7 @@ public class FunctionCall extends AbstractSuffixExpression { * @return the expression */ public String toStringExpression() { - final StringBuffer buff = new StringBuffer(prefix.toStringExpression()); + final StringBuffer buff = new StringBuffer(functionName.toStringExpression()); buff.append('('); if (args != null) { for (int i = 0; i < args.length; i++) { @@ -39,36 +49,37 @@ public class FunctionCall extends AbstractSuffixExpression { return buff.toString(); } - /** + /** * Get the variables from outside (parameters, globals ...) - * @return the variables from outside + * + * @param list the list where we will put variables */ - public List getOutsideVariable() { - return new ArrayList(); - } + public void getOutsideVariable(final List list) {} /** * get the modified variables. - * @return the variables from we change value + * + * @param list the list where we will put variables */ - public List getModifiedVariable() { - final ArrayList list = new ArrayList(); - for (int i = 0; i < args.length; i++) { - list.addAll(args[i].getModifiedVariable()); + public void getModifiedVariable(final List list) { + if (args != null) { + for (int i = 0; i < args.length; i++) { + args[i].getModifiedVariable(list); + } } - return list; } /** * Get the variables used. - * @return the variables used + * + * @param list the list where we will put variables */ - public List getUsedVariable() { - final ArrayList list = new ArrayList(); - list.addAll(prefix.getUsedVariable()); - for (int i = 0; i < args.length; i++) { - list.addAll(args[i].getUsedVariable()); + public void getUsedVariable(final List list) { + functionName.getUsedVariable(list); + if (args != null) { + for (int i = 0; i < args.length; i++) { + args[i].getUsedVariable(list); + } } - return list; } }