X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayDeclarator.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayDeclarator.java index 92fcd24..53e5b62 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayDeclarator.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayDeclarator.java @@ -1,22 +1,31 @@ package net.sourceforge.phpdt.internal.compiler.ast; import java.util.List; -import java.util.ArrayList; /** + * An access to a key of an array. * @author Matthieu Casanova */ -public class ArrayDeclarator extends AbstractVariable { +public final class ArrayDeclarator extends AbstractVariable { - public AbstractVariable prefix; - public Expression var; + /** The name of the array. */ + private final AbstractVariable prefix; + /** The key. */ + private final Expression key; + + /** + * Create an ArrayDeclarator. + * @param prefix the prefix, it could be a variable. + * @param key the key + * @param sourceEnd the end of the expression + */ public ArrayDeclarator(final AbstractVariable prefix, - final Expression vars, + final Expression key, final int sourceEnd) { super(prefix.sourceStart, sourceEnd); this.prefix = prefix; - this.var = vars; + this.key = key; } /** @@ -26,8 +35,8 @@ public class ArrayDeclarator extends AbstractVariable { public String toStringExpression() { final StringBuffer buff = new StringBuffer(prefix.toStringExpression()); buff.append('['); - if (var != null) { - buff.append(var.toStringExpression()); + if (key != null) { + buff.append(key.toStringExpression()); } buff.append(']'); return buff.toString(); @@ -35,7 +44,7 @@ public class ArrayDeclarator extends AbstractVariable { /** * Return the name of the variable. - * @return the name of the prefix variable + * @return the name of the functionName variable */ public String getName() { return prefix.getName(); @@ -43,33 +52,29 @@ public class ArrayDeclarator extends AbstractVariable { /** * Get the variables from outside (parameters, globals ...) - * @return the variables from outside + * @param list the list where we will put variables */ - public List getOutsideVariable() { - return new ArrayList(1); - } + public void getOutsideVariable(final List list) {} /** * get the modified variables. - * @return the variables from we change value + * @param list the list where we will put variables */ - public List getModifiedVariable() { - final List list = prefix.getModifiedVariable(); - if (var != null) { - list.addAll(var.getModifiedVariable()); + public void getModifiedVariable(final List list) { + prefix.getModifiedVariable(list); + if (key != null) { + key.getModifiedVariable(list); } - return list; } /** * Get the variables used. - * @return the variables used + * @param list the list where we will put variables */ - public List getUsedVariable() { - final List list = prefix.getUsedVariable(); - if (var != null) { - list.addAll(var.getUsedVariable()); + public void getUsedVariable(final List list) { + prefix.getUsedVariable(list); + if (key != null) { + key.getUsedVariable(list); } - return list; } }