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
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 {
20 public SuperReference(int sourceStart, int sourceEnd) {
21 super(sourceStart, sourceEnd);
24 public static ExplicitConstructorCall implicitSuperConstructorCall() {
25 return new ExplicitConstructorCall(
26 ExplicitConstructorCall.ImplicitSuper);
29 public boolean isImplicitThis() {
34 public boolean isSuper() {
39 public boolean isThis() {
44 public TypeBinding resolveType(BlockScope scope) {
45 constant = NotAConstant;
46 if (!checkAccess(scope.methodScope()))
48 SourceTypeBinding enclosingTb = scope.enclosingSourceType();
49 if (scope.isJavaLangObject(enclosingTb)) {
50 scope.problemReporter().cannotUseSuperInJavaLangObject(this);
53 return this.resolvedType = enclosingTb.superclass;
56 public String toStringExpression() {
58 return "super"; //$NON-NLS-1$
62 public void traverse(IAbstractSyntaxTreeVisitor visitor,
63 BlockScope blockScope) {
64 visitor.visit(this, blockScope);
65 visitor.endVisit(this, blockScope);