X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java new file mode 100644 index 0000000..bbbf44c --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java @@ -0,0 +1,39 @@ +package net.sourceforge.phpdt.internal.compiler.ast; + +/** + * A variable declaration. + * @author Matthieu Casanova + */ +public class VariableDeclaration extends AbstractVariableDeclaration { + + /** The value for variable initialization. */ + public Expression initialization; + + /** + * Create a variable. + * @param initialization the initialization + * @param name the name + * @param sourceStart the start point + * @param sourceEnd the end point + */ + public VariableDeclaration(Expression initialization, + char[] name, + int sourceStart, + int sourceEnd) { + this.initialization = initialization; + this.name = name; + //due to some declaration like + // int x, y = 3, z , x ; + //the sourceStart and the sourceEnd is ONLY on the name + this.sourceStart = sourceStart; + this.sourceEnd = sourceEnd; + } + + public String toString(int tab) { + String s = tabString(tab); + if (initialization != null) { + s += " = " + initialization.toStringExpression(tab); //$NON-NLS-1$ + } + return s; + } +}