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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.ast;
13 import org.eclipse.jdt.internal.compiler.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.lookup.*;
16 public class SingleTypeReference extends TypeReference {
20 public SingleTypeReference(char[] source, long pos) {
23 sourceStart = (int) (pos>>>32) ;
24 sourceEnd = (int) (pos & 0x00000000FFFFFFFFL) ;
28 public SingleTypeReference(char[] source ,TypeBinding type, long pos) {
30 this.resolvedType = type ;
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
37 return new ArrayTypeReference(token,null,dim,(((long)sourceStart)<<32)+sourceEnd) ;
40 public TypeBinding getTypeBinding(Scope scope) {
41 if (this.resolvedType != null)
42 return this.resolvedType;
43 return scope.getType(token);
46 public char [][] getTypeName() {
47 return new char[][] { token };
50 public StringBuffer printExpression(int indent, StringBuffer output){
52 return output.append(token);
55 public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
57 ReferenceBinding memberTb = scope.getMemberType(token, enclosingType);
58 if (!memberTb.isValidBinding()) {
59 scope.problemReporter().invalidEnclosingType(this, memberTb, enclosingType);
62 if (isTypeUseDeprecated(memberTb, scope))
63 scope.problemReporter().deprecatedType(memberTb, this);
64 return this.resolvedType = memberTb;
67 public void traverse(ASTVisitor visitor, BlockScope scope) {
68 visitor.visit(this, scope);
69 visitor.endVisit(this, scope);
72 public void traverse(ASTVisitor visitor, ClassScope scope) {
73 visitor.visit(this, scope);
74 visitor.endVisit(this, scope);