1 package net.sourceforge.phpdt.internal.compiler.ast;
5 * An argument declaration.
7 * @author Matthieu Casanova
9 public final class ArgumentDeclaration extends VariableDeclaration {
14 * @param name the name
15 * @param reference the variable is a reference ?
16 * @param initialization the initialization
17 * @param sourceStart the start point
19 public ArgumentDeclaration(final Variable name,
20 final boolean reference,
21 final Expression initialization,
22 final int sourceStart) {
23 super(name, initialization, VariableDeclaration.EQUAL, sourceStart);
24 this.reference = reference;
30 * @param name the name
31 * @param reference the variable is a reference ?
32 * @param sourceStart the start point
34 public ArgumentDeclaration(final Variable name,
35 final boolean reference,
36 final int sourceStart) {
37 super(name, sourceStart);
38 this.reference = reference;
42 * Return the expression as String.
44 * @return the expression
46 public String toStringExpression() {
47 if (initialization == null) {
49 return '&' + variable.toStringExpression();
51 return variable.toStringExpression();
54 final String variableString = variable.toStringExpression();
55 final String initializationString = initialization.toStringExpression();
56 final StringBuffer buff = new StringBuffer(4 +
57 variableString.length() +
58 initializationString.length());
62 buff.append(variableString);
64 buff.append(initializationString);
65 return buff.toString();