removed Makefile; lifted repo/org.ibex.tool/src/ to src/
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / ast / SingleTypeReference.java
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.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.lookup.*;
15
16 public class SingleTypeReference extends TypeReference {
17
18         public char[] token;
19
20         public SingleTypeReference(char[] source, long pos) {
21
22                         token = source;
23                         sourceStart = (int) (pos>>>32)  ;
24                         sourceEnd = (int) (pos & 0x00000000FFFFFFFFL) ;
25                 
26         }
27
28         public SingleTypeReference(char[] source ,TypeBinding type, long pos) {
29                 this(source, pos) ;
30                 this.resolvedType = type ;
31         }
32
33         public TypeReference copyDims(int dim){
34                 //return a type reference copy of me with some dimensions
35                 //warning : the new type ref has a null binding
36                 
37                 return new ArrayTypeReference(token,null,dim,(((long)sourceStart)<<32)+sourceEnd) ;
38         }
39
40         public TypeBinding getTypeBinding(Scope scope) {
41                 if (this.resolvedType != null)
42                         return this.resolvedType;
43                 return scope.getType(token);
44         }
45
46         public char [][] getTypeName() {
47                 return new char[][] { token };
48         }
49
50         public StringBuffer printExpression(int indent, StringBuffer output){
51                 
52                 return output.append(token);
53         }
54
55         public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
56
57                 ReferenceBinding memberTb = scope.getMemberType(token, enclosingType);
58                 if (!memberTb.isValidBinding()) {
59                         scope.problemReporter().invalidEnclosingType(this, memberTb, enclosingType);
60                         return null;
61                 }
62                 if (isTypeUseDeprecated(memberTb, scope))
63                         scope.problemReporter().deprecatedType(memberTb, this);
64                 return this.resolvedType = memberTb;
65         }
66
67         public void traverse(ASTVisitor visitor, BlockScope scope) {
68                 visitor.visit(this, scope);
69                 visitor.endVisit(this, scope);
70         }
71
72         public void traverse(ASTVisitor visitor, ClassScope scope) {
73                 visitor.visit(this, scope);
74                 visitor.endVisit(this, scope);
75         }
76 }