X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ForStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ForStatement.java index 212d451..9ee27d5 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ForStatement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ForStatement.java @@ -1,7 +1,6 @@ package net.sourceforge.phpdt.internal.compiler.ast; import java.util.List; -import java.util.ArrayList; /** * A For statement. @@ -20,6 +19,15 @@ public class ForStatement extends Statement { public Statement action; + /** + * a for statement + * @param initializations the initializations expressions + * @param condition the condition when the for get out + * @param increments the increments statements + * @param action the action (a statement, a block ...) + * @param sourceStart the beginning sources + * @param sourceEnd the ending sources + */ public ForStatement(final Expression[] initializations, final Expression condition, final Expression[] increments, @@ -70,52 +78,67 @@ public class ForStatement extends Statement { /** * Get the variables from outside (parameters, globals ...) - * @return the variables from outside */ - public List getOutsideVariable() { - final ArrayList list = new ArrayList(); - list.addAll(condition.getOutsideVariable()); - list.addAll(action.getOutsideVariable()); - for (int i = 0; i < initializations.length; i++) { - list.addAll(initializations[i].getOutsideVariable()); + public void getOutsideVariable(final List list) { + if (condition != null) { + condition.getOutsideVariable(list); + } + if (action != null) { + action.getOutsideVariable(list); } - for (int i = 0; i < increments.length; i++) { - list.addAll(increments[i].getOutsideVariable()); + if (initializations != null) { + for (int i = 0; i < initializations.length; i++) { + initializations[i].getOutsideVariable(list); + } + } + if (increments != null) { + for (int i = 0; i < increments.length; i++) { + increments[i].getOutsideVariable(list); + } } - return list; } /** * get the modified variables. - * @return the variables from we change value */ - public List getModifiedVariable() { - final ArrayList list = new ArrayList(); - list.addAll(condition.getModifiedVariable()); - list.addAll(action.getModifiedVariable()); - for (int i = 0; i < initializations.length; i++) { - list.addAll(initializations[i].getModifiedVariable()); + public void getModifiedVariable(final List list) { + if (condition != null) { + condition.getModifiedVariable(list); } - for (int i = 0; i < increments.length; i++) { - list.addAll(increments[i].getModifiedVariable()); + if (action != null) { + action.getModifiedVariable(list); + } + if (initializations != null) { + for (int i = 0; i < initializations.length; i++) { + initializations[i].getModifiedVariable(list); + } + } + if (increments != null) { + for (int i = 0; i < increments.length; i++) { + increments[i].getModifiedVariable(list); + } } - return list; } /** * Get the variables used. - * @return the variables used */ - public List getUsedVariable() { - final ArrayList list = new ArrayList(); - list.addAll(condition.getUsedVariable()); - list.addAll(action.getUsedVariable()); - for (int i = 0; i < initializations.length; i++) { - list.addAll(initializations[i].getUsedVariable()); + public void getUsedVariable(final List list) { + if (condition != null) { + condition.getUsedVariable(list); + } + if (action != null) { + action.getUsedVariable(list); } - for (int i = 0; i < increments.length; i++) { - list.addAll(increments[i].getUsedVariable()); + if (initializations != null) { + for (int i = 0; i < initializations.length; i++) { + initializations[i].getUsedVariable(list); + } + } + if (increments != null) { + for (int i = 0; i < increments.length; i++) { + increments[i].getUsedVariable(list); + } } - return list; } }