From: kpouer Date: Tue, 5 Aug 2003 22:13:43 +0000 (+0000) Subject: some little bugfixes X-Git-Url: http://git.phpeclipse.com some little bugfixes --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java index c213bd3..4322f61 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java @@ -4,24 +4,39 @@ import java.util.List; import java.util.ArrayList; /** - * This variable declaration do not extend AbstractVariableDeclaration because + * a variable declaration in an array(). * it could take Expression as key. * @author Matthieu Casanova */ public class ArrayVariableDeclaration extends Expression { - public Expression key,value; + /** the array key. */ + public Expression key; - public ArrayVariableDeclaration(final Expression key,final Expression value) { + /** the array value. */ + public Expression value; + + /** + * Create a new array variable declaration. + * @param key the key + * @param value the value + */ + public ArrayVariableDeclaration(final Expression key, final Expression value) { super(key.sourceStart, value.sourceEnd); this.key = key; this.value = value; } - public ArrayVariableDeclaration(final Expression key,final int sourceEnd) { + /** + * Create a new array variable declaration. + * @param key the key + * @param sourceEnd the end position + */ + public ArrayVariableDeclaration(final Expression key, final int sourceEnd) { super(key.sourceStart, sourceEnd); this.key = key; } + /** * Return the expression as String. * @return the expression @@ -37,8 +52,7 @@ public class ArrayVariableDeclaration extends Expression { } - - /** + /** * Get the variables from outside (parameters, globals ...) * @return the variables from outside */ @@ -53,7 +67,9 @@ public class ArrayVariableDeclaration extends Expression { public List getModifiedVariable() { final ArrayList list = new ArrayList(); list.addAll(key.getModifiedVariable()); - list.addAll(value.getModifiedVariable()); + if (value != null) { + list.addAll(value.getModifiedVariable()); + } return list; } @@ -63,7 +79,9 @@ public class ArrayVariableDeclaration extends Expression { */ public List getUsedVariable() { final ArrayList list = new ArrayList(); - list.addAll(value.getUsedVariable()); + if (value != null) { + list.addAll(value.getUsedVariable()); + } return list; } } 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 20a3c26..7f55b38 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,7 +1,6 @@ package net.sourceforge.phpdt.internal.compiler.ast; import net.sourceforge.phpdt.internal.compiler.parser.Outlineable; -import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage; import net.sourceforge.phpdt.internal.ui.PHPUiImages; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.text.Position;