some refactoring in the code analysis
authorkpouer <kpouer>
Mon, 4 Aug 2003 21:53:28 +0000 (21:53 +0000)
committerkpouer <kpouer>
Mon, 4 Aug 2003 21:53:28 +0000 (21:53 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java

index 93b8758..1118963 100644 (file)
@@ -241,11 +241,20 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild
 
 
     //look for used variables that were not declared before
+    findUnknownUsedVars(usedVars, declaredVars);
+  }
+
+  /**
+   * This method will add a warning on all used variables in a method that aren't declared before.
+   * @param usedVars the used variable list
+   * @param declaredVars the declared variable list
+   */
+  private void findUnknownUsedVars(final List usedVars, final List declaredVars) {
     for (int i = 0; i < usedVars.size(); i++) {
       VariableUsage variableUsage = (VariableUsage) usedVars.get(i);
       if (!isVariableDeclaredBefore(declaredVars, variableUsage)) {
         try {
-          PHPParserSuperclass.setMarker("warning, usage of an unknown : " + variableUsage.getName(),
+          PHPParserSuperclass.setMarker("warning, usage of an unknown variable : " + variableUsage.getName(),
                                         variableUsage.getStartOffset(),
                                         variableUsage.getStartOffset() + variableUsage.getName().length(),
                                         PHPParserSuperclass.WARNING,
@@ -254,7 +263,6 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild
           PHPeclipsePlugin.log(e);
         }
       }
-
     }
   }
 }