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 ArrayQualifiedTypeReference extends QualifiedTypeReference {
21 public ArrayQualifiedTypeReference(char[][] sources , int dim, long[] poss) {
22 super( sources , poss);
25 public ArrayQualifiedTypeReference(char[][] sources , TypeBinding tb, int dim, long[] poss) {
26 super( sources , tb, poss);
29 public int dimensions() {
32 public TypeBinding getTypeBinding(Scope scope) {
33 if (this.resolvedType != null)
34 return this.resolvedType;
35 if (dimensions > 255) {
36 scope.problemReporter().tooManyDimensions(this);
38 return scope.createArray(scope.getType(tokens), dimensions);
40 public String toStringExpression(int tab){
43 String s = super.toStringExpression(tab) ;
44 if (dimensions == 1 ) return s + "[]" ; //$NON-NLS-1$
45 for (int i=1 ; i <= dimensions ; i++)
46 s = s + "[]" ; //$NON-NLS-1$
49 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
50 visitor.visit(this, scope);
51 visitor.endVisit(this, scope);
53 public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
54 visitor.visit(this, scope);
55 visitor.endVisit(this, scope);