package net.sourceforge.phpdt.internal.compiler.ast;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+
+import java.util.List;
+import java.util.ArrayList;
+
/**
* A Variable assignation.
* $varname = initializer
/**
* Return the operator as String.
- * @return the operator
+ * @return the operator
*/
public final String operatorToString() {
switch (operator) {
* @return the expression
*/
public String toStringExpression() {
- final StringBuffer buff = new StringBuffer(variableName.toStringExpression());
+ final String varName = variableName.toStringExpression();
+ final String init = initializer.toStringExpression();
+ final String operatorString = operatorToString();
+ final StringBuffer buff = new StringBuffer(varName.length() + operatorString.length() + init.length() + 2);
+ buff.append(varName);
buff.append(" ");//$NON-NLS-1$
- buff.append(operatorToString());
+ buff.append(operatorString);
buff.append(" ");//$NON-NLS-1$
- buff.append(initializer.toStringExpression());
+ buff.append(init);
return buff.toString();
}
+
+
+ /**
+ * Get the variables from outside (parameters, globals ...)
+ * @return the variables from outside
+ */
+ public List getOutsideVariable() {
+ return new ArrayList();
+ }
+
+ /**
+ * get the modified variables.
+ * @return the variables from we change value
+ */
+ public List getModifiedVariable() {
+ final ArrayList list = new ArrayList();
+ list.addAll(variableName.getUsedVariable());
+ list.addAll(initializer.getModifiedVariable());
+ return list;
+ }
+
+ /**
+ * Get the variables used.
+ * @return the variables used
+ */
+ public List getUsedVariable() {
+ final ArrayList list = new ArrayList();
+ list.addAll(initializer.getUsedVariable());
+ return list;
+ }
}