import eclipse 3.1 M4 compiler
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / lookup / PackageBinding.java
index ee68a49..9f29f95 100644 (file)
@@ -17,7 +17,7 @@ import org.eclipse.jdt.internal.compiler.util.HashtableOfType;
 public class PackageBinding extends Binding implements TypeConstants {
        public char[][] compoundName;
        PackageBinding parent;
-       LookupEnvironment environment;
+       public LookupEnvironment environment;
        HashtableOfType knownTypes;
        HashtableOfPackage knownPackages;
 protected PackageBinding() {
@@ -59,8 +59,15 @@ void addType(ReferenceBinding element) {
 * Answer the receiver's binding type from Binding.BindingID.
 */
 
-public final int bindingType() {
-       return PACKAGE;
+public final int kind() {
+       return Binding.PACKAGE;
+}
+/*
+ * slash separated name
+ * org.eclipse.jdt.core --> org/eclipse/jdt/core
+ */
+public char[] computeUniqueKey() {
+       return CharOperation.concatWith(compoundName, '/');
 }
 private PackageBinding findPackage(char[] name) {
        if (!environment.isPackage(this.compoundName, name))
@@ -112,22 +119,22 @@ PackageBinding getPackage0(char[] name) {
 */
 
 ReferenceBinding getType(char[] name) {
-       ReferenceBinding binding = getType0(name);
-       if (binding == null) {
-               if ((binding = environment.askForType(this, name)) == null) {
+       ReferenceBinding typeBinding = getType0(name);
+       if (typeBinding == null) {
+               if ((typeBinding = environment.askForType(this, name)) == null) {
                        // not found so remember a problem type binding in the cache for future lookups
                        addNotFoundType(name);
                        return null;
                }
        }
 
-       if (binding == LookupEnvironment.TheNotFoundType)
+       if (typeBinding == LookupEnvironment.TheNotFoundType)
                return null;
-       if (binding instanceof UnresolvedReferenceBinding)
-               binding = ((UnresolvedReferenceBinding) binding).resolve(environment);
-       if (binding.isNestedType())
+
+       typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now
+       if (typeBinding.isNestedType())
                return new ProblemReferenceBinding(name, InternalNameProvided);
-       return binding;
+       return typeBinding;
 }
 /* Answer the type named name if it exists in the cache.
 * Answer theNotFoundType if it could not be resolved the first time
@@ -155,8 +162,7 @@ ReferenceBinding getType0(char[] name) {
 public Binding getTypeOrPackage(char[] name) {
        ReferenceBinding typeBinding = getType0(name);
        if (typeBinding != null && typeBinding != LookupEnvironment.TheNotFoundType) {
-               if (typeBinding instanceof UnresolvedReferenceBinding)
-                       typeBinding = ((UnresolvedReferenceBinding) typeBinding).resolve(environment);
+               typeBinding = BinaryTypeBinding.resolveType(typeBinding, environment, false); // no raw conversion for now
                if (typeBinding.isNestedType())
                        return new ProblemReferenceBinding(name, InternalNameProvided);
                return typeBinding;