1 package net.sourceforge.phpdt.internal.compiler.ast;
7 * @author Matthieu Casanova
9 public class ClassAccess extends AbstractVariable {
11 /** a static class access : "::" */
12 public static final int STATIC = 0;
14 /** a normal class access : "->" */
15 public static final int NORMAL = 1;
17 public Expression prefix;
20 public Expression suffix;
22 /** the type of access. */
26 * Create a new class access.
29 * @param type the type of access {@link #STATIC} or {@link #NORMAL}
31 public ClassAccess(final Expression prefix,
32 final Expression suffix,
34 super(prefix.sourceStart, suffix.sourceEnd);
40 public String toStringOperator() {
42 case STATIC : return "::"; //$NON-NLS-1$
43 case NORMAL : return "->"; //$NON-NLS-1$
45 return "unknown operator"; //$NON-NLS-1$
49 * Return the expression as String.
50 * @return the expression
52 public String toStringExpression() {
53 final StringBuffer buff = new StringBuffer();
54 buff.append(prefix.toStringExpression());
55 buff.append(toStringOperator());
56 buff.append(suffix.toStringExpression());
57 return buff.toString();
61 * todo: find a better way to handle this
64 public String getName() {
65 if (prefix instanceof AbstractVariable) {
66 return ((AbstractVariable)prefix).getName();
68 return prefix.toStringExpression();
72 * Get the variables from outside (parameters, globals ...)
74 public void getOutsideVariable(final List list) {
78 * get the modified variables.
80 public void getModifiedVariable(final List list) {
84 * Get the variables used.
86 public void getUsedVariable(final List list) {
87 prefix.getUsedVariable(list);
88 suffix.getUsedVariable(list);