changes about variables
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / Variable.java
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
new file mode 100644 (file)
index 0000000..a6d027a
--- /dev/null
@@ -0,0 +1,59 @@
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Matthieu Casanova
+ */
+public class Variable extends Expression {
+
+  /** The name of the variable. */
+  public char[] name;
+
+
+  public Variable(final char[] name, final int sourceStart, final int sourceEnd) {
+    super(sourceStart, sourceEnd);
+    this.name = name;
+  }
+
+    /**
+   * Return the expression as String.
+   * @return the expression
+   */
+  public String toStringExpression() {
+    return "$"+new String(name);
+  }
+
+  public String getName() {
+    return new String(name);
+  }
+
+  /**
+   * Get the variables from outside (parameters, globals ...)
+   * @return the variables from outside
+   */
+  public List getOutsideVariable() {
+    return new ArrayList(1);
+  }
+
+  /**
+   * get the modified variables.
+   * @return the variables modified
+   */
+  public List getModifiedVariable() {
+    final ArrayList list = new ArrayList(1);
+    list.add(new VariableUsage(getName(),sourceStart));
+    return list;
+  }
+
+  /**
+   * Get the variables used.
+   * @return the variables used
+   */
+  public List getUsedVariable() {
+    return new ArrayList(1);
+  }
+}