X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Variable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Variable.java index c091d8b..bd3c0fd 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Variable.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Variable.java @@ -4,6 +4,7 @@ import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage; import java.util.List; import java.util.ArrayList; +import java.util.Arrays; /** * A variable. @@ -18,6 +19,29 @@ public class Variable extends AbstractVariable { /** A variable inside ($$varname). */ private AbstractVariable variable; + public static final String _GET = "_GET"; + public static final String _POST = "_POST"; + public static final String _REQUEST = "_REQUEST"; + public static final String _SERVER = "_SERVER"; + public static final String _SESSION = "_SESSION"; + public static final String _this = "this"; + public static final String GLOBALS = "GLOBALS"; + public static final String _COOKIE = "_COOKIE"; + public static final String _FILES = "_FILES"; + public static final String _ENV = "_ENV"; + + /** Here is an array of all superglobals variables and the special "this". */ + public static final String[] SPECIAL_VARS = {_GET, + _POST, + _REQUEST, + _SERVER, + _SESSION, + _this, + GLOBALS, + _COOKIE, + _FILES, + _ENV}; + /** * Create a new simple variable. * @param name the name @@ -80,12 +104,17 @@ public class Variable extends AbstractVariable { * @return the variables used */ public List getUsedVariable() { - final ArrayList list = new ArrayList(1); + final String varName; if (name == null) { - list.add(new VariableUsage(variable.getName(), sourceStart)); + varName = variable.getName(); } else { - list.add(new VariableUsage(name, sourceStart)); + varName = name; } + if (arrayContains(SPECIAL_VARS, name)) { + return new ArrayList(1); + } + final ArrayList list = new ArrayList(1); + list.add(new VariableUsage(varName, sourceStart)); return list; } }