removed Makefile; lifted repo/org.ibex.tool/src/ to src/
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / ast / ArrayTypeReference.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.ast;
12
13 import org.eclipse.jdt.internal.compiler.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.lookup.*;
15
16 public class ArrayTypeReference extends SingleTypeReference {
17         public int dimensions;
18
19         /**
20          * ArrayTypeReference constructor comment.
21          * @param source char[]
22          * @param dimensions int
23          * @param pos int
24          */
25         public ArrayTypeReference(char[] source, int dimensions, long pos) {
26                 
27                 super(source, pos);
28                 this.dimensions = dimensions ;
29         }
30         
31         public ArrayTypeReference(char[] source, TypeBinding tb, int dimensions, long pos) {
32                 
33                 super(source, tb, pos);
34                 this.dimensions = dimensions ;
35         }
36         
37         public int dimensions() {
38                 
39                 return dimensions;
40         }
41         
42         public TypeBinding getTypeBinding(Scope scope) {
43                 
44                 if (this.resolvedType != null) return this.resolvedType;
45                 if (dimensions > 255) {
46                         scope.problemReporter().tooManyDimensions(this);
47                 }
48                 return scope.createArray(scope.getType(token), dimensions);
49         
50         }
51         
52         public StringBuffer printExpression(int indent, StringBuffer output){
53         
54                 super.printExpression(indent, output)  ;
55                 for (int i= 0 ; i < dimensions ; i++) {
56                         output.append("[]"); //$NON-NLS-1$
57                 }
58                 return output;
59         }
60         
61         public void traverse(ASTVisitor visitor, BlockScope scope) {
62                 
63                 visitor.visit(this, scope);
64                 visitor.endVisit(this, scope);
65         }
66 }