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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpeclipse.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 type , long[] poss) {
30 this.resolvedType = type;
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) {
39 if (this.resolvedType != null)
40 return this.resolvedType;
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);