improved code formatter
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / internal / compiler / ast / SuperReference.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 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 net.sourceforge.phpeclipse.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.SourceTypeBinding;
16 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
17
18 public class SuperReference extends ThisReference {
19         
20 public SuperReference(int sourceStart, int sourceEnd) {
21         super(sourceStart, sourceEnd);
22 }
23 public static ExplicitConstructorCall implicitSuperConstructorCall() {
24         return new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);
25 }
26 public boolean isImplicitThis() {
27         
28         return false;
29 }
30 public boolean isSuper() {
31         
32         return true;
33 }
34 public boolean isThis() {
35         
36         return false ;
37 }
38 public TypeBinding resolveType(BlockScope scope) {
39         constant = NotAConstant;
40         if (!checkAccess(scope.methodScope()))
41                 return null;
42         SourceTypeBinding enclosingTb = scope.enclosingSourceType();
43         if (scope.isJavaLangObject(enclosingTb)) {
44                 scope.problemReporter().cannotUseSuperInJavaLangObject(this);
45                 return null;
46         }
47         return this.resolvedType = enclosingTb.superclass;
48 }
49 public String toStringExpression(){
50
51         return "super"; //$NON-NLS-1$
52         
53 }
54 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
55         visitor.visit(this, blockScope);
56         visitor.endVisit(this, blockScope);
57 }
58 }