From 8ad4a50d536695f75c60cd6d7be135ac7563d08f Mon Sep 17 00:00:00 2001 From: kpouer Date: Tue, 12 Aug 2003 21:56:14 +0000 Subject: [PATCH] the methods do not share informations about their variables --- .../internal/compiler/ast/MethodDeclaration.java | 31 +++++++++++++------ 1 files changed, 21 insertions(+), 10 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 4e017eb..48fdda2 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 @@ -155,11 +155,24 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild return children; } + /** no outside variables. */ + public List getOutsideVariable() { + return new ArrayList(1); + } + + public List getModifiedVariable() { + return new ArrayList(1); + } + + public List getUsedVariable() { + return new ArrayList(1); + } + /** - * Get global variables (not parameters) + * Get global variables (not parameters). * @return the variables from outside */ - public List getOutsideVariable() { + public List getGlobalVariable() { final ArrayList list = new ArrayList(); if (statements != null) { @@ -185,7 +198,7 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild * get the modified variables. * @return the variables from we change value */ - public List getModifiedVariable() { + private List getAssignedVariableInCode() { final ArrayList list = new ArrayList(); if (statements != null) { for (int i = 0; i < statements.length; i++) { @@ -199,7 +212,7 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild * Get the variables used. * @return the variables used */ - public List getUsedVariable() { + private List getUsedVariableInCode() { final ArrayList list = new ArrayList(); if (statements != null) { for (int i = 0; i < statements.length; i++) { @@ -221,9 +234,7 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild return false; } - /** - * This method will analyze the code. - */ + /** This method will analyze the code. */ public void analyzeCode() { if (statements != null) { for (int i = 0; i < statements.length; i++) { @@ -232,8 +243,8 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild } } - final List globalsVars = getOutsideVariable(); - final List modifiedVars = getModifiedVariable(); + final List globalsVars = getGlobalVariable(); + final List modifiedVars = getAssignedVariableInCode(); final List parameters = getParameters(new ArrayList()); final List declaredVars = new ArrayList(globalsVars.size() + modifiedVars.size()); @@ -241,7 +252,7 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild declaredVars.addAll(modifiedVars); declaredVars.addAll(parameters); - final List usedVars = getUsedVariable(); + final List usedVars = getUsedVariableInCode(); final List readOrWriteVars = new ArrayList(modifiedVars.size()+usedVars.size()); readOrWriteVars.addAll(modifiedVars); readOrWriteVars.addAll(usedVars); -- 1.7.1