removed Makefile; lifted repo/org.ibex.tool/src/ to src/
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / ast / QualifiedTypeReference.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 QualifiedTypeReference extends TypeReference {
17
18         public char[][] tokens;
19         public long[] sourcePositions;
20
21         public QualifiedTypeReference(char[][] sources , long[] poss) {
22                 
23                 tokens = sources ;
24                 sourcePositions = poss ;
25                 sourceStart = (int) (sourcePositions[0]>>>32) ;
26                 sourceEnd = (int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFFL ) ;
27         }
28         
29         public QualifiedTypeReference(char[][] sources , TypeBinding type , long[] poss) {
30                 
31                 this(sources,poss);
32                 this.resolvedType = type;
33         }
34         
35         public TypeReference copyDims(int dim){
36                 //return a type reference copy of me with some dimensions
37                 //warning : the new type ref has a null binding
38                 return new ArrayQualifiedTypeReference(tokens,null,dim,sourcePositions) ;
39         }
40         
41         public TypeBinding getTypeBinding(Scope scope) {
42                 
43                 if (this.resolvedType != null)
44                         return this.resolvedType;
45                 return scope.getType(tokens);
46         }
47         
48         public char[][] getTypeName(){
49         
50                 return tokens;
51         }
52         
53         public StringBuffer printExpression(int indent, StringBuffer output) {
54                 
55                 for (int i = 0; i < tokens.length; i++) {
56                         if (i > 0) output.append('.');
57                         output.append(tokens[i]);
58                 }
59                 return output;
60         }
61         
62         public void traverse(ASTVisitor visitor, BlockScope scope) {
63                 
64                 visitor.visit(this, scope);
65                 visitor.endVisit(this, scope);
66         }
67         
68         public void traverse(ASTVisitor visitor, ClassScope scope) {
69                 
70                 visitor.visit(this, scope);
71                 visitor.endVisit(this, scope);
72         }
73 }