1 package net.sourceforge.phpdt.internal.compiler.ast;
4 import java.util.ArrayList;
8 * @author Matthieu Casanova
10 public class ClassAccess extends AbstractVariable {
12 /** a static class access : "::" */
13 public static final int STATIC = 0;
15 /** a normal class access : "->" */
16 public static final int NORMAL = 1;
18 public Expression prefix;
21 public Expression suffix;
23 /** the type of access. */
27 * Create a new class access.
30 * @param type the type of access {@link #STATIC} or {@link #NORMAL}
32 public ClassAccess(final Expression prefix,
33 final Expression suffix,
35 super(prefix.sourceStart, suffix.sourceEnd);
41 public String toStringOperator() {
43 case STATIC : return "::"; //$NON-NLS-1$
44 case NORMAL : return "->"; //$NON-NLS-1$
46 return "unknown operator"; //$NON-NLS-1$
50 * Return the expression as String.
51 * @return the expression
53 public String toStringExpression() {
54 final StringBuffer buff = new StringBuffer();
55 buff.append(prefix.toStringExpression());
56 buff.append(toStringOperator());
57 buff.append(suffix.toStringExpression());
58 return buff.toString();
62 * todo: find a better way to handle this
65 public String getName() {
66 if (prefix instanceof AbstractVariable) {
67 return ((AbstractVariable)prefix).getName();
69 return prefix.toStringExpression();
73 * Get the variables from outside (parameters, globals ...)
75 public void getOutsideVariable(final List list) {
79 * get the modified variables.
81 public void getModifiedVariable(final List list) {
85 * Get the variables used.
87 public void getUsedVariable(final List list) {
88 prefix.getUsedVariable(list);
89 suffix.getUsedVariable(list);