removed NPE in XMLPreferenceInitializer
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / QualifiedSuperReference.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.ASTVisitor;
14 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
15 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
16
17 public class QualifiedSuperReference extends QualifiedThisReference {
18         
19         public QualifiedSuperReference(TypeReference name, int pos, int sourceEnd) {
20                 super(name, pos, sourceEnd);
21         }
22
23         public boolean isSuper() {
24
25                 return true;
26         }
27
28         public boolean isThis() {
29
30                 return false;
31         }
32
33         public TypeBinding resolveType(BlockScope scope) {
34
35                 if ((this.bits & ParenthesizedMASK) != 0) {
36                         scope.problemReporter().invalidParenthesizedExpression(this);
37                         return null;
38                 }
39                 super.resolveType(scope);
40                 if (currentCompatibleType == null)
41                         return null; // error case
42
43                 if (scope.isJavaLangObject(currentCompatibleType)) {
44                         scope.problemReporter().cannotUseSuperInJavaLangObject(this);
45                         return null;
46                 }
47                 return this.resolvedType = currentCompatibleType.superclass();
48         }
49
50         public String toStringExpression() {
51
52                 return qualification.toString(0) + ".super"; //$NON-NLS-1$
53         }
54
55         public void traverse(
56             ASTVisitor visitor,
57                 BlockScope blockScope) {
58
59                 if (visitor.visit(this, blockScope)) {
60                         qualification.traverse(visitor, blockScope);
61                 }
62                 visitor.endVisit(this, blockScope);
63         }
64 }