3.x RC1 compatibility
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / FunctionCall.java
index 19fcbee..d897240 100644 (file)
@@ -1,25 +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 {
 
   /** the function name. */
-  public Expression prefix;
+  private final Expression functionName;
 
   /** the arguments. */
-  public Expression[] args;
+  private final Expression[] args;
 
-  public FunctionCall(final Expression prefix,
+  /**
+   * a function call.
+   * it's <code>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;
   }
 
@@ -28,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++) {
@@ -45,38 +51,35 @@ public class FunctionCall extends AbstractSuffixExpression {
 
   /**
    * 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(1);
-  }
+  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() {
-    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());
+  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 List list = prefix.getUsedVariable();
+  public void getUsedVariable(final List list) {
+    functionName.getUsedVariable(list);
     if (args != null) {
       for (int i = 0; i < args.length; i++) {
-        list.addAll(args[i].getUsedVariable());
+        args[i].getUsedVariable(list);
       }
     }
-    return list;
   }
 }