1) Added setting of syntax properties to italic, underline and strike through.
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / NameReference.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 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 net.sourceforge.phpdt.internal.compiler.ast;
12
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;
19
20 public abstract class NameReference extends Reference implements
21                 InvocationSite, BindingIds {
22
23         public Binding binding, codegenBinding; // may be
24                                                                                         // aTypeBinding-aFieldBinding-aLocalVariableBinding
25
26         public TypeBinding receiverType; // raw receiver type
27
28         public TypeBinding actualReceiverType; // modified receiver type - actual
29                                                                                         // one according to namelookup
30
31         // the error printing
32         // some name reference are build as name reference but
33         // only used as type reference. When it happens, instead of
34         // creating a new objet (aTypeReference) we just flag a boolean
35         // This concesion is valuable while their are cases when the NameReference
36         // will be a TypeReference (static message sends.....) and there is
37         // no changeClass in java.
38         public NameReference() {
39                 super();
40                 bits |= TYPE | VARIABLE; // restrictiveFlag
41
42         }
43
44         public FieldBinding fieldBinding() {
45                 // this method should be sent ONLY after a check against
46                 // isFieldReference()
47                 // check its use doing senders.........
48
49                 return (FieldBinding) binding;
50         }
51
52         public boolean isSuperAccess() {
53                 return false;
54         }
55
56         public boolean isTypeAccess() {
57                 // null is acceptable when we are resolving the first part of a
58                 // reference
59                 return binding == null || binding instanceof ReferenceBinding;
60         }
61
62         public boolean isTypeReference() {
63                 return binding instanceof ReferenceBinding;
64         }
65
66         public void setActualReceiverType(ReferenceBinding receiverType) {
67                 this.actualReceiverType = receiverType;
68         }
69
70         public void setDepth(int depth) {
71                 bits &= ~DepthMASK; // flush previous depth if any
72                 if (depth > 0) {
73                         bits |= (depth & 0xFF) << DepthSHIFT; // encoded on 8 bits
74                 }
75         }
76
77         public void setFieldIndex(int index) {
78                 // ignored
79         }
80
81         public abstract String unboundReferenceErrorName();
82 }