Makefile fixup
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / ast / SuperReference.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.BlockScope;
15 import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
16 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
17
18 public class SuperReference extends ThisReference {
19         
20         public SuperReference(int sourceStart, int sourceEnd) {
21
22                 super(sourceStart, sourceEnd);
23         }
24
25         public static ExplicitConstructorCall implicitSuperConstructorCall() {
26
27                 return new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);
28         }
29
30         public boolean isImplicitThis() {
31                 
32                 return false;
33         }
34
35         public boolean isSuper() {
36                 
37                 return true;
38         }
39
40         public boolean isThis() {
41                 
42                 return false ;
43         }
44
45         public StringBuffer printExpression(int indent, StringBuffer output){
46         
47                 return output.append("super"); //$NON-NLS-1$
48                 
49         }
50
51         public TypeBinding resolveType(BlockScope scope) {
52
53                 constant = NotAConstant;
54                 if (!checkAccess(scope.methodScope()))
55                         return null;
56                 SourceTypeBinding enclosingTb = scope.enclosingSourceType();
57                 if (enclosingTb.id == T_Object) {
58                         scope.problemReporter().cannotUseSuperInJavaLangObject(this);
59                         return null;
60                 }
61                 return this.resolvedType = enclosingTb.superclass;
62         }
63
64         public void traverse(ASTVisitor visitor, BlockScope blockScope) {
65                 visitor.visit(this, blockScope);
66                 visitor.endVisit(this, blockScope);
67         }
68 }