1 package net.sourceforge.phpdt.internal.compiler.ast;
6 * a variable declaration in an array().
7 * it could take Expression as key.
9 * @author Matthieu Casanova
11 public final class ArrayVariableDeclaration extends Expression {
14 private final Expression key;
16 /** the array value. */
17 private Expression value;
20 * Create a new array variable declaration.
23 * @param value the value
25 public ArrayVariableDeclaration(final Expression key, final Expression value) {
26 super(key.sourceStart, value.sourceEnd);
32 * Create a new array variable declaration.
35 * @param sourceEnd the end position
37 public ArrayVariableDeclaration(final Expression key, final int sourceEnd) {
38 super(key.sourceStart, sourceEnd);
43 * Return the expression as String.
45 * @return the expression
47 public String toStringExpression() {
49 return key.toStringExpression();
51 final String keyString = key.toStringExpression();
52 final String valueString = value.toStringExpression();
53 final StringBuffer buff = new StringBuffer(keyString.length() + valueString.length() + 3);
54 buff.append(keyString);
56 buff.append(valueString);
57 return buff.toString();
63 * Get the variables from outside (parameters, globals ...)
65 * @param list the list where we will put variables
67 public void getOutsideVariable(final List list) {
71 * get the modified variables.
73 * @param list the list where we will put variables
75 public void getModifiedVariable(final List list) {
76 key.getModifiedVariable(list);
78 value.getModifiedVariable(list);
83 * Get the variables used.
85 * @param list the list where we will put variables
87 public void getUsedVariable(final List list) {
88 key.getUsedVariable(list);
90 value.getUsedVariable(list);