From 4b50dbf01c1de172a1780fbe9efb1938085eebfb Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 4 Jun 2013 14:19:00 +0400 Subject: [PATCH] Better debug names for lazy scopes --- .../lazy/descriptors/LazyClassDescriptor.java | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/descriptors/LazyClassDescriptor.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/descriptors/LazyClassDescriptor.java index f75541bfdcf..d0d4e108a57 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/descriptors/LazyClassDescriptor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/descriptors/LazyClassDescriptor.java @@ -89,7 +89,6 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc private final NotNullLazyValue scopeForMemberDeclarationResolution; private final NotNullLazyValue scopeForPropertyInitializerResolution; - public LazyClassDescriptor( @NotNull ResolveSession resolveSession, @NotNull DeclarationDescriptor containingDeclaration, @@ -108,6 +107,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc classLikeInfo.getClassKind() != ClassKind.ENUM_CLASS ? classLikeInfo : noEnumEntries(classLikeInfo); this.declarationProvider = resolveSession.getDeclarationProviderFactory().getClassMemberDeclarationProvider(classLikeInfoForMembers); this.containingDeclaration = containingDeclaration; + this.unsubstitutedMemberScope = new LazyClassMemberScope(resolveSession, declarationProvider, this); this.unsubstitutedInnerClassesScope = new InnerClassesScopeWrapper(unsubstitutedMemberScope); @@ -182,18 +182,17 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc @NotNull private JetScope computeScopeForClassHeaderResolution() { - WritableScopeImpl scope = new WritableScopeImpl( - JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Class Header Resolution"); + WritableScopeImpl scope = new WritableScopeImpl(JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Scope with type parameters for " + name); for (TypeParameterDescriptor typeParameterDescriptor : getTypeConstructor().getParameters()) { scope.addClassifierDescriptor(typeParameterDescriptor); } scope.changeLockLevel(WritableScope.LockLevel.READING); PsiElement scopeAnchor = declarationProvider.getOwnerInfo().getScopeAnchor(); - return new ChainedScope( - this, - "ScopeForClassHeaderResolution: " + getName(), - scope, getScopeProvider().getResolutionScopeForDeclaration(scopeAnchor)); + + return new ChainedScope(this, "ScopeForClassHeaderResolution: " + getName(), + scope, + getScopeProvider().getResolutionScopeForDeclaration(scopeAnchor)); } @NotNull @@ -203,15 +202,16 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc @NotNull private JetScope computeScopeForMemberDeclarationResolution() { - WritableScopeImpl scope = new WritableScopeImpl( - JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Member Declaration Resolution"); - scope.addLabeledDeclaration(this); - scope.changeLockLevel(WritableScope.LockLevel.READING); + WritableScopeImpl thisScope = new WritableScopeImpl(JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Scope with 'this' for " + name); + thisScope.addLabeledDeclaration(this); + thisScope.changeLockLevel(WritableScope.LockLevel.READING); return new ChainedScope( this, "ScopeForMemberDeclarationResolution: " + getName(), - scope, getScopeForMemberLookup(), getScopeForClassHeaderResolution()); + thisScope, + getScopeForMemberLookup(), + getScopeForClassHeaderResolution()); } @NotNull @@ -224,14 +224,10 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc ConstructorDescriptor primaryConstructor = getUnsubstitutedPrimaryConstructor(); if (primaryConstructor == null) return getScopeForMemberDeclarationResolution(); - WritableScopeImpl scope = new WritableScopeImpl( - JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Property Initializer Resolution"); - - List parameters = primaryConstructor.getValueParameters(); - for (ValueParameterDescriptor valueParameterDescriptor : parameters) { + WritableScopeImpl scope = new WritableScopeImpl(JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Scope with constructor parameters in " + name); + for (ValueParameterDescriptor valueParameterDescriptor : primaryConstructor.getValueParameters()) { scope.addVariableDescriptor(valueParameterDescriptor); } - scope.changeLockLevel(WritableScope.LockLevel.READING); return new ChainedScope(