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.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;
 
  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 StringBuffer printExpression(int indent, StringBuffer output) {
 
  49         for (int i = 0; i < tokens.length; i++) {
 
  50                 if (i > 0) output.append('.');
 
  51                 output.append(tokens[i]);
 
  55 public String toStringExpression(int tab) {
 
  56         StringBuffer buffer = new StringBuffer();
 
  57         for (int i = 0; i < tokens.length; i++) {
 
  58                 buffer.append(tokens[i]);
 
  59                 if (i < (tokens.length - 1)) {
 
  60                         buffer.append("."); //$NON-NLS-1$
 
  63         return buffer.toString();
 
  65 public void traverse(ASTVisitor visitor, BlockScope scope) {
 
  66         visitor.visit(this, scope);
 
  67         visitor.endVisit(this, scope);
 
  69 public void traverse(ASTVisitor visitor, ClassScope scope) {
 
  70         visitor.visit(this, scope);
 
  71         visitor.endVisit(this, scope);