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.*;
16 public class SingleTypeReference extends TypeReference {
20 public SingleTypeReference(char[] source, long pos) {
22 sourceStart = (int) (pos>>>32) ;
23 sourceEnd = (int) (pos & 0x00000000FFFFFFFFL) ;
26 public SingleTypeReference(char[] source ,TypeBinding tb, long pos) {
30 public TypeReference copyDims(int dim){
31 //return a type reference copy of me with some dimensions
32 //warning : the new type ref has a null binding
34 return new ArrayTypeReference(token,null,dim,(((long)sourceStart)<<32)+sourceEnd) ;
36 public TypeBinding getTypeBinding(Scope scope) {
39 return scope.getType(token);
41 public char [][] getTypeName() {
42 return new char[][] { token };
44 public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
45 ReferenceBinding memberTb = scope.getMemberType(token, enclosingType);
46 if (!memberTb.isValidBinding()) {
47 scope.problemReporter().invalidEnclosingType(this, memberTb, enclosingType);
50 if (isTypeUseDeprecated(memberTb, scope))
51 scope.problemReporter().deprecatedType(memberTb, this);
52 return binding = memberTb;
54 public String toStringExpression(int tab){
55 return new String(token) ;
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);