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
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
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;
18 public class SuperReference extends ThisReference {
19 public static final SuperReference Super = new SuperReference();
22 * SuperReference constructor comment.
24 public SuperReference() {
27 public SuperReference(int pos, int sourceEnd) {
30 this.sourceEnd = sourceEnd;
32 public static ExplicitConstructorCall implicitSuperConstructorCall() {
33 return new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);
35 public boolean isSuper() {
39 public boolean isThis() {
43 public TypeBinding resolveType(BlockScope scope) {
44 constant = NotAConstant;
45 if (!checkAccess(scope.methodScope()))
47 SourceTypeBinding enclosingTb = scope.enclosingSourceType();
48 if (scope.isJavaLangObject(enclosingTb)) {
49 scope.problemReporter().cannotUseSuperInJavaLangObject(this);
52 return enclosingTb.superclass;
54 public String toStringExpression(){
56 return "super"; //$NON-NLS-1$
59 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
60 visitor.visit(this, blockScope);
61 visitor.endVisit(this, blockScope);