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 index 4ba1ba5..6d01007 100644 --- 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 @@ -1,10 +1,9 @@ package net.sourceforge.phpdt.internal.compiler.ast; -import net.sourceforge.phpdt.internal.compiler.ast.Expression; -import net.sourceforge.phpdt.internal.compiler.ast.AbstractVariableDeclaration; import net.sourceforge.phpdt.internal.compiler.parser.Outlineable; import net.sourceforge.phpdt.internal.ui.PHPUiImages; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.text.Position; /** * A variable declaration. @@ -17,7 +16,7 @@ public class VariableDeclaration extends AbstractVariableDeclaration implements private Object parent; private boolean reference; - + private Position position; /** * Create a variable. * @param initialization the initialization @@ -31,6 +30,20 @@ public class VariableDeclaration extends AbstractVariableDeclaration implements super(name, sourceStart, initialization.sourceEnd); this.initialization = initialization; this.parent = parent; + position = new Position(sourceStart, sourceEnd); + } + + /** + * Create a variable. + * @param name the name of the variable + * @param sourceStart the start point + */ + public VariableDeclaration(Object parent, + char[] name, + int sourceStart, + int sourceEnd) { + super(name, sourceStart, sourceEnd); + this.parent = parent; } public void setReference(boolean reference) { @@ -49,6 +62,17 @@ public class VariableDeclaration extends AbstractVariableDeclaration implements super(name, sourceStart, initialization.sourceEnd); this.initialization = initialization; } + + /** + * Create a variable. + * @param name the name of the variable + * @param sourceStart the start point + */ + public VariableDeclaration(char[] name, + int sourceStart) { + super(name, sourceStart, sourceStart + name.length); + } + /** * Return the variable into String. * @return a String @@ -56,9 +80,9 @@ public class VariableDeclaration extends AbstractVariableDeclaration implements public String toStringExpression() { final StringBuffer buff; if (reference) { - buff = new StringBuffer('&'); + buff = new StringBuffer("&$"); //$NON-NLS-1$ } else { - buff = new StringBuffer(); + buff = new StringBuffer("$");//$NON-NLS-1$ } buff.append(name); if (initialization != null) { @@ -72,11 +96,15 @@ public class VariableDeclaration extends AbstractVariableDeclaration implements return parent; } - /** - * Get the image of a variable. - * @return the image that represents a php variable - */ - public ImageDescriptor getImage() { - return PHPUiImages.DESC_VAR; - } + /** + * Get the image of a variable. + * @return the image that represents a php variable + */ + public ImageDescriptor getImage() { + return PHPUiImages.DESC_VAR; + } + + public Position getPosition() { + return position; + } }