KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > ast > NameReference


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-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 {
16
17     public Binding binding, codegenBinding; //may be aTypeBinding-aFieldBinding-aLocalVariableBinding
18

19     public TypeBinding actualReceiverType; // modified receiver type - actual one according to namelookup
20

21     //the error printing
22
//some name reference are build as name reference but
23
//only used as type reference. When it happens, instead of
24
//creating a new objet (aTypeReference) we just flag a boolean
25
//This concesion is valuable while their are cases when the NameReference
26
//will be a TypeReference (static message sends.....) and there is
27
//no changeClass in java.
28
public NameReference() {
29     super();
30     bits |= Binding.TYPE | Binding.VARIABLE; // restrictiveFlag
31

32 }
33 public FieldBinding fieldBinding() {
34     //this method should be sent ONLY after a check against isFieldReference()
35
//check its use doing senders.........
36

37     return (FieldBinding) binding ;
38 }
39 public boolean isSuperAccess() {
40     return false;
41 }
42 public boolean isTypeAccess() {
43     // null is acceptable when we are resolving the first part of a reference
44
return binding == null || binding instanceof ReferenceBinding;
45 }
46 public boolean isTypeReference() {
47     return binding instanceof ReferenceBinding;
48 }
49 public void setActualReceiverType(ReferenceBinding receiverType) {
50     if (receiverType == null) return; // error scenario only
51
this.actualReceiverType = receiverType;
52 }
53 public 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 }
59 public void setFieldIndex(int index){
60     // ignored
61
}
62
63 public abstract String JavaDoc unboundReferenceErrorName();
64 }
65
Popular Tags