01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.compiler.ast;
11:
12: import org.eclipse.jdt.internal.compiler.ASTVisitor;
13: import org.eclipse.jdt.internal.compiler.lookup.*;
14:
15: public class QualifiedSuperReference extends QualifiedThisReference {
16:
17: public QualifiedSuperReference(TypeReference name, int pos,
18: int sourceEnd) {
19: super (name, pos, sourceEnd);
20: }
21:
22: public boolean isSuper() {
23:
24: return true;
25: }
26:
27: public boolean isThis() {
28:
29: return false;
30: }
31:
32: public StringBuffer printExpression(int indent, StringBuffer output) {
33:
34: return qualification.print(0, output).append(".super"); //$NON-NLS-1$
35: }
36:
37: public TypeBinding resolveType(BlockScope scope) {
38:
39: if ((this .bits & ParenthesizedMASK) != 0) {
40: scope.problemReporter()
41: .invalidParenthesizedExpression(this );
42: return null;
43: }
44: super .resolveType(scope);
45: if (currentCompatibleType == null)
46: return null; // error case
47:
48: if (currentCompatibleType.id == T_JavaLangObject) {
49: scope.problemReporter()
50: .cannotUseSuperInJavaLangObject(this );
51: return null;
52: }
53: return this .resolvedType = currentCompatibleType.super class();
54: }
55:
56: public void traverse(ASTVisitor visitor, BlockScope blockScope) {
57:
58: if (visitor.visit(this , blockScope)) {
59: qualification.traverse(visitor, blockScope);
60: }
61: visitor.endVisit(this , blockScope);
62: }
63:
64: public void traverse(ASTVisitor visitor, ClassScope blockScope) {
65:
66: if (visitor.visit(this, blockScope)) {
67: qualification.traverse(visitor, blockScope);
68: }
69: visitor.endVisit(this, blockScope);
70: }
71: }
|