diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.java index bfaec5b35c7..aaa97de4b1c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BindingContextUtils.java @@ -43,7 +43,7 @@ public class BindingContextUtils { if (declarationDescriptor instanceof CallableMemberDescriptor) { CallableMemberDescriptor callable = (CallableMemberDescriptor) declarationDescriptor; if (callable.getKind() != CallableMemberDescriptor.Kind.DECLARATION) { - throw new IllegalStateException("non-declaration descriptors should be filtered out earler: " + callable); + throw new IllegalStateException("non-declaration descriptors should be filtered out earlier: " + callable); } } //if (declarationDescriptor instanceof VariableAsFunctionDescriptor) { @@ -56,8 +56,8 @@ public class BindingContextUtils { } }; - static final ReadOnlySlice DESCRIPTOR_TO_DECLARATION = - Slices.sliceBuilder().setKeyNormalizer(DECLARATION_DESCRIPTOR_NORMALIZER).build(); + /*package*/ static final ReadOnlySlice DESCRIPTOR_TO_DECLARATION = + Slices.sliceBuilder().setKeyNormalizer(DECLARATION_DESCRIPTOR_NORMALIZER).setDebugName("DESCRIPTOR_TO_DECLARATION").build(); @Nullable public static PsiElement resolveToDeclarationPsiElement(@NotNull BindingContext bindingContext, @Nullable JetReferenceExpression referenceExpression) { diff --git a/compiler/frontend/src/org/jetbrains/jet/util/slicedmap/BasicWritableSlice.java b/compiler/frontend/src/org/jetbrains/jet/util/slicedmap/BasicWritableSlice.java index a85b66dc4ac..65ddf735b54 100644 --- a/compiler/frontend/src/org/jetbrains/jet/util/slicedmap/BasicWritableSlice.java +++ b/compiler/frontend/src/org/jetbrains/jet/util/slicedmap/BasicWritableSlice.java @@ -16,6 +16,8 @@ package org.jetbrains.jet.util.slicedmap; +import org.jetbrains.annotations.NotNull; + import java.lang.reflect.Field; import java.lang.reflect.Modifier; @@ -87,6 +89,13 @@ public class BasicWritableSlice implements WritableSlice { return isCollective; } + public void setDebugName(@NotNull String debugName) { + if (this.debugName != null) { + throw new IllegalStateException("Debug name already set for " + this); + } + this.debugName = debugName; + } + @Override public String toString() { return debugName; diff --git a/compiler/frontend/src/org/jetbrains/jet/util/slicedmap/Slices.java b/compiler/frontend/src/org/jetbrains/jet/util/slicedmap/Slices.java index e2b4b232146..b4b538c5a1f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/util/slicedmap/Slices.java +++ b/compiler/frontend/src/org/jetbrains/jet/util/slicedmap/Slices.java @@ -16,6 +16,8 @@ package org.jetbrains.jet.util.slicedmap; +import org.jetbrains.annotations.NotNull; + import java.util.Arrays; import java.util.List; @@ -82,6 +84,8 @@ public class Slices { private RewritePolicy rewritePolicy; + private String debugName; + private SliceBuilder(RewritePolicy rewritePolicy) { this.rewritePolicy = rewritePolicy; } @@ -101,12 +105,25 @@ public class Slices { return this; } + public SliceBuilder setDebugName(@NotNull String debugName) { + this.debugName = debugName; + return this; + } + public SliceBuilder setKeyNormalizer(KeyNormalizer keyNormalizer) { this.keyNormalizer = keyNormalizer; return this; } public RemovableSlice build() { + SliceWithOpposite result = doBuild(); + if (debugName != null) { + result.setDebugName(debugName); + } + return result; + } + + private SliceWithOpposite doBuild() { if (defaultValue != null) { return new SliceWithOpposite(rewritePolicy, opposite, keyNormalizer) { @Override @@ -133,7 +150,6 @@ public class Slices { } return new SliceWithOpposite(rewritePolicy, opposite, keyNormalizer); } - } public static class BasicRemovableSlice extends BasicWritableSlice implements RemovableSlice {