*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / ArrayQualifiedTypeReference.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
12
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;
18
19 public class ArrayQualifiedTypeReference extends QualifiedTypeReference {
20         int dimensions;
21 public ArrayQualifiedTypeReference(char[][] sources , int dim, long[] poss) {
22         super( sources , poss);
23         dimensions = dim ;
24 }
25 public ArrayQualifiedTypeReference(char[][] sources , TypeBinding tb, int dim, long[] poss) {
26         super( sources , tb, poss);
27         dimensions = dim ;
28 }
29 public int dimensions() {
30         return dimensions;
31 }
32 public TypeBinding getTypeBinding(Scope scope) {
33         if (binding != null)
34                 return binding;
35         return scope.createArray(scope.getType(tokens), dimensions);
36 }
37 public String toStringExpression(int tab){
38         /* slow speed */
39
40         String s = super.toStringExpression(tab)  ;
41         if (dimensions == 1 ) return s + "[]" ; //$NON-NLS-1$
42         for (int i=1 ; i <= dimensions ; i++)
43                 s = s + "[]" ; //$NON-NLS-1$
44         return s ;
45 }
46 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
47         visitor.visit(this, scope);
48         visitor.endVisit(this, scope);
49 }
50 public void traverse(IAbstractSyntaxTreeVisitor visitor, ClassScope scope) {
51         visitor.visit(this, scope);
52         visitor.endVisit(this, scope);
53 }
54 }