From 2f007e2e08adc82a96b5fa1eeaa57c6956b8996f Mon Sep 17 00:00:00 2001 From: kpouer Date: Mon, 4 Aug 2003 21:53:28 +0000 Subject: [PATCH] some refactoring in the code analysis --- .../internal/compiler/ast/MethodDeclaration.java | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java index 93b8758..1118963 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java @@ -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); } } - } } } -- 1.7.1