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 ArrayTypeReference extends SingleTypeReference {
17 public int dimensions;
19 * ArrayTypeReference constructor comment.
20 * @param source char[]
24 public ArrayTypeReference(char[] source, int dim, long pos) {
28 public ArrayTypeReference(char[] source, TypeBinding tb, int dim, long pos) {
29 super(source, tb, pos);
31 public int dimensions() {
34 public TypeBinding getTypeBinding(Scope scope) {
37 return scope.createArray(scope.getType(token), dimensions);
39 public String toStringExpression(int tab){
42 String s = super.toStringExpression(tab) ;
43 if (dimensions == 1 ) return s + "[]" ; //$NON-NLS-1$
44 for (int i=1 ; i <= dimensions ; i++)
45 s = s + "[]" ; //$NON-NLS-1$
48 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
49 visitor.visit(this, scope);
50 visitor.endVisit(this, scope);