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 ArrayTypeReference extends SingleTypeReference {
17 public int dimensions;
20 * ArrayTypeReference constructor comment.
21 * @param source char[]
22 * @param dimensions int
25 public ArrayTypeReference(char[] source, int dimensions, long pos) {
28 this.dimensions = dimensions ;
31 public ArrayTypeReference(char[] source, TypeBinding tb, int dimensions, long pos) {
33 super(source, tb, pos);
34 this.dimensions = dimensions ;
37 public int dimensions() {
42 public TypeBinding getTypeBinding(Scope scope) {
44 if (this.resolvedType != null) return this.resolvedType;
45 if (dimensions > 255) {
46 scope.problemReporter().tooManyDimensions(this);
48 return scope.createArray(scope.getType(token), dimensions);
52 public StringBuffer printExpression(int indent, StringBuffer output){
54 super.printExpression(indent, output) ;
55 for (int i= 0 ; i < dimensions ; i++) {
56 output.append("[]"); //$NON-NLS-1$
61 public void traverse(ASTVisitor visitor, BlockScope scope) {
63 visitor.visit(this, scope);
64 visitor.endVisit(this, scope);