1 /*******************************************************************************
2 * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v0.5
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v05.html
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.lookup.Binding;
14 import net.sourceforge.phpdt.internal.compiler.lookup.BindingIds;
15 import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
16 import net.sourceforge.phpdt.internal.compiler.lookup.InvocationSite;
17 import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
18 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
20 public abstract class NameReference extends Reference implements InvocationSite, BindingIds {
22 public Binding binding, codegenBinding; //may be aTypeBinding-aFieldBinding-aLocalVariableBinding
24 public TypeBinding receiverType, actualReceiverType;
27 //some name reference are build as name reference but
28 //only used as type reference. When it happens, instead of
29 //creating a new objet (aTypeReference) we just flag a boolean
30 //This concesion is valuable while their are cases when the NameReference
31 //will be a TypeReference (static message sends.....) and there is
32 //no changeClass in java.
33 public NameReference() {
35 bits |= TYPE | VARIABLE; // restrictiveFlag
38 public FieldBinding fieldBinding() {
39 //this method should be sent ONLY after a check against isFieldReference()
40 //check its use doing senders.........
42 return (FieldBinding) binding ;
44 public boolean isSuperAccess() {
47 public boolean isTypeAccess() {
48 // null is acceptable when we are resolving the first part of a reference
49 return binding == null || binding instanceof ReferenceBinding;
51 public boolean isTypeReference() {
52 return binding instanceof ReferenceBinding;
54 public void setActualReceiverType(ReferenceBinding receiverType) {
55 this.actualReceiverType = receiverType;
57 public void setDepth(int depth) {
59 bits &= ~DepthMASK; // flush previous depth if any
60 bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
63 public void setFieldIndex(int index){
67 public abstract String unboundReferenceErrorName();