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.phpdt.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
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;
22 public long[] sourcePositions;
24 public QualifiedTypeReference(char[][] sources, long[] poss) {
26 sourcePositions = poss;
27 sourceStart = (int) (sourcePositions[0] >>> 32);
28 sourceEnd = (int) (sourcePositions[sourcePositions.length - 1] & 0x00000000FFFFFFFFL);
31 public QualifiedTypeReference(char[][] sources, TypeBinding type,
34 this.resolvedType = type;
37 public TypeReference copyDims(int dim) {
38 // return a type reference copy of me with some dimensions
39 // warning : the new type ref has a null binding
41 return new ArrayQualifiedTypeReference(tokens, null, dim,
45 public TypeBinding getTypeBinding(Scope scope) {
46 if (this.resolvedType != null)
47 return this.resolvedType;
48 return scope.getType(tokens);
51 public char[][] getTypeName() {
56 public StringBuffer printExpression(int indent, StringBuffer output) {
58 for (int i = 0; i < tokens.length; i++) {
61 output.append(tokens[i]);
66 public String toStringExpression(int tab) {
67 StringBuffer buffer = new StringBuffer();
68 for (int i = 0; i < tokens.length; i++) {
69 buffer.append(tokens[i]);
70 if (i < (tokens.length - 1)) {
71 buffer.append("."); //$NON-NLS-1$
74 return buffer.toString();
77 public void traverse(ASTVisitor visitor, BlockScope scope) {
78 visitor.visit(this, scope);
79 visitor.endVisit(this, scope);
82 public void traverse(ASTVisitor visitor, ClassScope scope) {
83 visitor.visit(this, scope);
84 visitor.endVisit(this, scope);