a small bugfix for list(,$var) case
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / MethodDeclaration.java
index 424ca3b..4e017eb 100644 (file)
@@ -172,9 +172,10 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild
 
   private List getParameters(final List list) {
     if (arguments != null) {
-      final Enumeration vars = arguments.keys();
+      final Enumeration vars = arguments.elements();
       while (vars.hasMoreElements()) {
-        list.add(new VariableUsage((String) vars.nextElement(), sourceStart));
+        final VariableDeclaration variable = (VariableDeclaration) vars.nextElement();
+        list.add(new VariableUsage(variable.name(), variable.sourceStart));
       }
     }
     return list;
@@ -220,20 +221,17 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild
     return false;
   }
 
-  private void dumpList(List list, String name) {
-    StringBuffer buff = new StringBuffer(name).append("\n");
-    for (int i = 0; i < list.size(); i++) {
-      buff.append(list.get(i).toString()).append("\n");
-    }
-    if (PHPeclipsePlugin.DEBUG) {
-      PHPeclipsePlugin.log(1, buff.toString());
-    }
-  }
-
   /**
    * This method will analyze the code.
    */
   public void analyzeCode() {
+    if (statements != null) {
+      for (int i = 0; i < statements.length; i++) {
+        statements[i].analyzeCode();
+
+      }
+    }
+
     final List globalsVars = getOutsideVariable();
     final List modifiedVars = getModifiedVariable();
     final List parameters = getParameters(new ArrayList());
@@ -247,10 +245,6 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild
     final List readOrWriteVars = new ArrayList(modifiedVars.size()+usedVars.size());
     readOrWriteVars.addAll(modifiedVars);
     readOrWriteVars.addAll(usedVars);
-/*    dumpList(globalsVars, "outside");
-    dumpList(modifiedVars, "modified");
-    dumpList(usedVars, "used");  */
-
 
     //look for used variables that were not declared before
     findUnusedParameters(readOrWriteVars,parameters);