Better debug names for lazy scopes
This commit is contained in:
+14
-18
@@ -89,7 +89,6 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
private final NotNullLazyValue<JetScope> scopeForMemberDeclarationResolution;
|
private final NotNullLazyValue<JetScope> scopeForMemberDeclarationResolution;
|
||||||
private final NotNullLazyValue<JetScope> scopeForPropertyInitializerResolution;
|
private final NotNullLazyValue<JetScope> scopeForPropertyInitializerResolution;
|
||||||
|
|
||||||
|
|
||||||
public LazyClassDescriptor(
|
public LazyClassDescriptor(
|
||||||
@NotNull ResolveSession resolveSession,
|
@NotNull ResolveSession resolveSession,
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@@ -108,6 +107,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
classLikeInfo.getClassKind() != ClassKind.ENUM_CLASS ? classLikeInfo : noEnumEntries(classLikeInfo);
|
classLikeInfo.getClassKind() != ClassKind.ENUM_CLASS ? classLikeInfo : noEnumEntries(classLikeInfo);
|
||||||
this.declarationProvider = resolveSession.getDeclarationProviderFactory().getClassMemberDeclarationProvider(classLikeInfoForMembers);
|
this.declarationProvider = resolveSession.getDeclarationProviderFactory().getClassMemberDeclarationProvider(classLikeInfoForMembers);
|
||||||
this.containingDeclaration = containingDeclaration;
|
this.containingDeclaration = containingDeclaration;
|
||||||
|
|
||||||
this.unsubstitutedMemberScope = new LazyClassMemberScope(resolveSession, declarationProvider, this);
|
this.unsubstitutedMemberScope = new LazyClassMemberScope(resolveSession, declarationProvider, this);
|
||||||
this.unsubstitutedInnerClassesScope = new InnerClassesScopeWrapper(unsubstitutedMemberScope);
|
this.unsubstitutedInnerClassesScope = new InnerClassesScopeWrapper(unsubstitutedMemberScope);
|
||||||
|
|
||||||
@@ -182,18 +182,17 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private JetScope computeScopeForClassHeaderResolution() {
|
private JetScope computeScopeForClassHeaderResolution() {
|
||||||
WritableScopeImpl scope = new WritableScopeImpl(
|
WritableScopeImpl scope = new WritableScopeImpl(JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Scope with type parameters for " + name);
|
||||||
JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Class Header Resolution");
|
|
||||||
for (TypeParameterDescriptor typeParameterDescriptor : getTypeConstructor().getParameters()) {
|
for (TypeParameterDescriptor typeParameterDescriptor : getTypeConstructor().getParameters()) {
|
||||||
scope.addClassifierDescriptor(typeParameterDescriptor);
|
scope.addClassifierDescriptor(typeParameterDescriptor);
|
||||||
}
|
}
|
||||||
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||||
|
|
||||||
PsiElement scopeAnchor = declarationProvider.getOwnerInfo().getScopeAnchor();
|
PsiElement scopeAnchor = declarationProvider.getOwnerInfo().getScopeAnchor();
|
||||||
return new ChainedScope(
|
|
||||||
this,
|
return new ChainedScope(this, "ScopeForClassHeaderResolution: " + getName(),
|
||||||
"ScopeForClassHeaderResolution: " + getName(),
|
scope,
|
||||||
scope, getScopeProvider().getResolutionScopeForDeclaration(scopeAnchor));
|
getScopeProvider().getResolutionScopeForDeclaration(scopeAnchor));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -203,15 +202,16 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private JetScope computeScopeForMemberDeclarationResolution() {
|
private JetScope computeScopeForMemberDeclarationResolution() {
|
||||||
WritableScopeImpl scope = new WritableScopeImpl(
|
WritableScopeImpl thisScope = new WritableScopeImpl(JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Scope with 'this' for " + name);
|
||||||
JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Member Declaration Resolution");
|
thisScope.addLabeledDeclaration(this);
|
||||||
scope.addLabeledDeclaration(this);
|
thisScope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||||
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
|
||||||
|
|
||||||
return new ChainedScope(
|
return new ChainedScope(
|
||||||
this,
|
this,
|
||||||
"ScopeForMemberDeclarationResolution: " + getName(),
|
"ScopeForMemberDeclarationResolution: " + getName(),
|
||||||
scope, getScopeForMemberLookup(), getScopeForClassHeaderResolution());
|
thisScope,
|
||||||
|
getScopeForMemberLookup(),
|
||||||
|
getScopeForClassHeaderResolution());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -224,14 +224,10 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
ConstructorDescriptor primaryConstructor = getUnsubstitutedPrimaryConstructor();
|
ConstructorDescriptor primaryConstructor = getUnsubstitutedPrimaryConstructor();
|
||||||
if (primaryConstructor == null) return getScopeForMemberDeclarationResolution();
|
if (primaryConstructor == null) return getScopeForMemberDeclarationResolution();
|
||||||
|
|
||||||
WritableScopeImpl scope = new WritableScopeImpl(
|
WritableScopeImpl scope = new WritableScopeImpl(JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Scope with constructor parameters in " + name);
|
||||||
JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Property Initializer Resolution");
|
for (ValueParameterDescriptor valueParameterDescriptor : primaryConstructor.getValueParameters()) {
|
||||||
|
|
||||||
List<ValueParameterDescriptor> parameters = primaryConstructor.getValueParameters();
|
|
||||||
for (ValueParameterDescriptor valueParameterDescriptor : parameters) {
|
|
||||||
scope.addVariableDescriptor(valueParameterDescriptor);
|
scope.addVariableDescriptor(valueParameterDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||||
|
|
||||||
return new ChainedScope(
|
return new ChainedScope(
|
||||||
|
|||||||
Reference in New Issue
Block a user