first scanner /parser copied from the jdt java version
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / QualifiedSuperReference.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.*;
15
16 public class QualifiedSuperReference extends QualifiedThisReference {
17         
18         public QualifiedSuperReference(TypeReference name, int pos, int sourceEnd) {
19                 super(name, pos, sourceEnd);
20         }
21
22         public boolean isSuper() {
23
24                 return true;
25         }
26
27         public boolean isThis() {
28
29                 return false;
30         }
31
32         public TypeBinding resolveType(BlockScope scope) {
33
34                 super.resolveType(scope);
35                 if (currentCompatibleType == null)
36                         return null; // error case
37
38                 if (scope.isJavaLangObject(currentCompatibleType)) {
39                         scope.problemReporter().cannotUseSuperInJavaLangObject(this);
40                         return null;
41                 }
42                 return currentCompatibleType.superclass();
43         }
44
45         public String toStringExpression() {
46
47                 return qualification.toString(0) + ".super"; //$NON-NLS-1$
48         }
49
50         public void traverse(
51                 IAbstractSyntaxTreeVisitor visitor,
52                 BlockScope blockScope) {
53
54                 if (visitor.visit(this, blockScope)) {
55                         qualification.traverse(visitor, blockScope);
56                 }
57                 visitor.endVisit(this, blockScope);
58         }
59 }