1 /******************************************************************************* 2 * Copyright (c) 2000, 2004 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Common Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/cpl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.jdt.internal.compiler.ast; 12 13 import org.eclipse.jdt.internal.compiler.lookup.*; 14 15 public abstract class NameReference extends Reference implements InvocationSite, BindingIds { 16 17 public Binding binding, codegenBinding; //may be aTypeBinding-aFieldBinding-aLocalVariableBinding 18 19 public TypeBinding receiverType; // raw receiver type 20 public TypeBinding actualReceiverType; // modified receiver type - actual one according to namelookup 21 22 //the error printing 23 //some name reference are build as name reference but 24 //only used as type reference. When it happens, instead of 25 //creating a new objet (aTypeReference) we just flag a boolean 26 //This concesion is valuable while their are cases when the NameReference 27 //will be a TypeReference (static message sends.....) and there is 28 //no changeClass in java. NameReference()29public NameReference() { 30 super(); 31 bits |= TYPE | VARIABLE; // restrictiveFlag 32 33 } fieldBinding()34public FieldBinding fieldBinding() { 35 //this method should be sent ONLY after a check against isFieldReference() 36 //check its use doing senders......... 37 38 return (FieldBinding) binding ; 39 } isSuperAccess()40public boolean isSuperAccess() { 41 return false; 42 } isTypeAccess()43public boolean isTypeAccess() { 44 // null is acceptable when we are resolving the first part of a reference 45 return binding == null || binding instanceof ReferenceBinding; 46 } isTypeReference()47public boolean isTypeReference() { 48 return binding instanceof ReferenceBinding; 49 } setActualReceiverType(ReferenceBinding receiverType)50public void setActualReceiverType(ReferenceBinding receiverType) { 51 this.actualReceiverType = receiverType; 52 } setDepth(int depth)53public void setDepth(int depth) { 54 bits &= ~DepthMASK; // flush previous depth if any 55 if (depth > 0) { 56 bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits 57 } 58 } setFieldIndex(int index)59public void setFieldIndex(int index){ 60 // ignored 61 } 62 unboundReferenceErrorName()63public abstract String unboundReferenceErrorName(); 64 } 65