X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/GlobalStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/GlobalStatement.java index 8d17144..d50bafe 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/GlobalStatement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/GlobalStatement.java @@ -1,8 +1,13 @@ 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; + +import java.util.List; +import java.util.ArrayList; /** * A GlobalStatement statement in php. @@ -15,24 +20,30 @@ public class GlobalStatement extends Statement implements Outlineable { private Object parent; - public GlobalStatement(Object parent, String[] variables, int sourceStart, int sourceEnd) { + private Position position; + + public GlobalStatement(final Object parent, + final String[] variables, + final int sourceStart, + final int sourceEnd) { super(sourceStart, sourceEnd); this.variables = variables; this.parent = parent; + position = new Position(sourceStart, sourceEnd); } public String toString() { - StringBuffer buff = new StringBuffer("global "); + final StringBuffer buff = new StringBuffer("global ");//$NON-NLS-1$ for (int i = 0; i < variables.length; i++) { if (i != 0) { - buff.append(", "); + buff.append(", ");//$NON-NLS-1$ } buff.append(variables[i]); } return buff.toString(); } - public String toString(int tab) { + public String toString(final int tab) { return tabString(tab) + toString(); } @@ -47,4 +58,36 @@ public class GlobalStatement extends Statement implements Outlineable { public Object getParent() { return parent; } + + public Position getPosition() { + return position; + } + + /** + * Get the variables from outside (parameters, globals ...) + * @return the variables from outside + */ + public List getOutsideVariable() { + final ArrayList list = new ArrayList(variables.length); + for (int i = 0; i < variables.length; i++) { + list.add(new VariableUsage(variables[i],sourceStart)); + } + return list; + } + + /** + * get the modified variables. + * @return the variables modified + */ + public List getModifiedVariable() { + return new ArrayList(); + } + + /** + * Get the variables used. + * @return the variables used + */ + public List getUsedVariable() { + return new ArrayList(); + } }