reenabled folding preference for inner types
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / lookup / UnresolvedReferenceBinding.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.lookup;
12
13 import net.sourceforge.phpdt.core.compiler.CharOperation;
14
15 public class UnresolvedReferenceBinding extends ReferenceBinding {
16         ReferenceBinding resolvedType;
17 UnresolvedReferenceBinding(char[][] compoundName, PackageBinding packageBinding) {
18         this.compoundName = compoundName;
19         this.fPackage = packageBinding;
20 }
21 String debugName() {
22         return toString();
23 }
24 ReferenceBinding resolve(LookupEnvironment environment) {
25         if (resolvedType != null) return resolvedType;
26
27         ReferenceBinding environmentType = fPackage.getType0(compoundName[compoundName.length - 1]);
28         if (environmentType == this)
29                 environmentType = environment.askForType(compoundName);
30         if (environmentType != null && environmentType != this) { // could not resolve any better, error was already reported against it
31                 resolvedType = environmentType;
32                 environment.updateArrayCache(this, environmentType);
33                 return environmentType; // when found, it replaces the unresolved type in the cache
34         }
35
36         environment.problemReporter.isClassPathCorrect(compoundName, null);
37         return null; // will not get here since the above error aborts the compilation
38 }
39 public String toString() {
40         return "Unresolved type " + ((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED"); //$NON-NLS-1$ //$NON-NLS-2$
41 }
42 }