Change Eclipse-LazyStart: true to Bundle-ActivationPolicy: lazy (upgrade to The Equin...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / 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.phpdt.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
24         public static ExplicitConstructorCall implicitSuperConstructorCall() {
25                 return new ExplicitConstructorCall(
26                                 ExplicitConstructorCall.ImplicitSuper);
27         }
28
29         public boolean isImplicitThis() {
30
31                 return false;
32         }
33
34         public boolean isSuper() {
35
36                 return true;
37         }
38
39         public boolean isThis() {
40
41                 return false;
42         }
43
44         public TypeBinding resolveType(BlockScope scope) {
45                 constant = NotAConstant;
46                 if (!checkAccess(scope.methodScope()))
47                         return null;
48                 SourceTypeBinding enclosingTb = scope.enclosingSourceType();
49                 if (scope.isJavaLangObject(enclosingTb)) {
50                         scope.problemReporter().cannotUseSuperInJavaLangObject(this);
51                         return null;
52                 }
53                 return this.resolvedType = enclosingTb.superclass;
54         }
55
56         public String toStringExpression() {
57
58                 return "super"; //$NON-NLS-1$
59
60         }
61
62         public void traverse(IAbstractSyntaxTreeVisitor visitor,
63                         BlockScope blockScope) {
64                 visitor.visit(this, blockScope);
65                 visitor.endVisit(this, blockScope);
66         }
67 }