1 /*******************************************************************************
2 * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v0.5
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v05.html
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
15 import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
16 import net.sourceforge.phpdt.internal.compiler.lookup.Scope;
17 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
19 public class QualifiedTypeReference extends TypeReference {
20 public char[][] tokens;
21 public long[] sourcePositions;
22 public QualifiedTypeReference(char[][] sources , long[] poss) {
24 sourcePositions = poss ;
25 sourceStart = (int) (sourcePositions[0]>>>32) ;
26 sourceEnd = (int)(sourcePositions[sourcePositions.length-1] & 0x00000000FFFFFFFFL ) ;
28 public QualifiedTypeReference(char[][] sources , TypeBinding tb , long[] poss) {
32 public TypeReference copyDims(int dim){
33 //return a type reference copy of me with some dimensions
34 //warning : the new type ref has a null binding
36 return new ArrayQualifiedTypeReference(tokens,null,dim,sourcePositions) ;
38 public TypeBinding getTypeBinding(Scope scope) {
41 return scope.getType(tokens);
43 public char[][] getTypeName(){
47 public String toStringExpression(int tab) {
48 StringBuffer buffer = new StringBuffer();
49 for (int i = 0; i < tokens.length; i++) {
50 buffer.append(tokens[i]);
51 if (i < (tokens.length - 1)) {
52 buffer.append("."); //$NON-NLS-1$
55 return buffer.toString();
57 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
58 visitor.visit(this, scope);
59 visitor.endVisit(this, scope);
61 public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
62 visitor.visit(this, scope);
63 visitor.endVisit(this, scope);