Debug names for chained scopes in lazy resolve
This commit is contained in:
@@ -135,7 +135,10 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||||
|
|
||||||
PsiElement scopeAnchor = declarationProvider.getOwnerInfo().getScopeAnchor();
|
PsiElement scopeAnchor = declarationProvider.getOwnerInfo().getScopeAnchor();
|
||||||
scopeForClassHeaderResolution = new ChainedScope(this, scope, getScopeProvider().getResolutionScopeForDeclaration(scopeAnchor));
|
scopeForClassHeaderResolution = new ChainedScope(
|
||||||
|
this,
|
||||||
|
"ScopeForClassHeaderResolution: " + getName(),
|
||||||
|
scope, getScopeProvider().getResolutionScopeForDeclaration(scopeAnchor));
|
||||||
}
|
}
|
||||||
return scopeForClassHeaderResolution;
|
return scopeForClassHeaderResolution;
|
||||||
}
|
}
|
||||||
@@ -147,7 +150,10 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
scope.addLabeledDeclaration(this);
|
scope.addLabeledDeclaration(this);
|
||||||
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||||
|
|
||||||
scopeForMemberDeclarationResolution = new ChainedScope(this, scope, getScopeForMemberLookup(), getScopeForClassHeaderResolution());
|
scopeForMemberDeclarationResolution = new ChainedScope(
|
||||||
|
this,
|
||||||
|
"ScopeForMemberDeclarationResolution: " + getName(),
|
||||||
|
scope, getScopeForMemberLookup(), getScopeForClassHeaderResolution());
|
||||||
}
|
}
|
||||||
return scopeForMemberDeclarationResolution;
|
return scopeForMemberDeclarationResolution;
|
||||||
}
|
}
|
||||||
@@ -167,7 +173,10 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
|
|
||||||
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||||
|
|
||||||
scopeForPropertyInitializerResolution = new ChainedScope(this, scope, getScopeForMemberDeclarationResolution());
|
scopeForPropertyInitializerResolution = new ChainedScope(
|
||||||
|
this,
|
||||||
|
"ScopeForPropertyInitializerResolution: " + getName(),
|
||||||
|
scope, getScopeForMemberDeclarationResolution());
|
||||||
}
|
}
|
||||||
return scopeForPropertyInitializerResolution;
|
return scopeForPropertyInitializerResolution;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ public class LazyPackageDescriptor extends AbstractNamespaceDescriptorImpl imple
|
|||||||
|
|
||||||
this.lazyScope = new LazyPackageMemberScope(resolveSession, declarationProvider, this);
|
this.lazyScope = new LazyPackageMemberScope(resolveSession, declarationProvider, this);
|
||||||
|
|
||||||
this.memberScope = new ChainedScope(this, lazyScope, scope);
|
this.memberScope = new ChainedScope(this, "Lazy package members scope: " + name, lazyScope, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -30,13 +30,20 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class ChainedScope implements JetScope {
|
public class ChainedScope implements JetScope {
|
||||||
private final DeclarationDescriptor containingDeclaration;
|
private final DeclarationDescriptor containingDeclaration;
|
||||||
|
private final String debugName;
|
||||||
private final JetScope[] scopeChain;
|
private final JetScope[] scopeChain;
|
||||||
private Collection<DeclarationDescriptor> allDescriptors;
|
private Collection<DeclarationDescriptor> allDescriptors;
|
||||||
private List<ReceiverParameterDescriptor> implicitReceiverHierarchy;
|
private List<ReceiverParameterDescriptor> implicitReceiverHierarchy;
|
||||||
|
|
||||||
public ChainedScope(DeclarationDescriptor containingDeclaration, JetScope... scopes) {
|
public ChainedScope(DeclarationDescriptor containingDeclaration, JetScope... scopes) {
|
||||||
|
this(containingDeclaration, "Untitled chained scope", scopes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChainedScope(DeclarationDescriptor containingDeclaration, String debugName, JetScope... scopes) {
|
||||||
this.containingDeclaration = containingDeclaration;
|
this.containingDeclaration = containingDeclaration;
|
||||||
scopeChain = scopes.clone();
|
scopeChain = scopes.clone();
|
||||||
|
|
||||||
|
this.debugName = debugName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -133,7 +140,7 @@ public class ChainedScope implements JetScope {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(LabelName labelName) {
|
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||||
for (JetScope jetScope : scopeChain) {
|
for (JetScope jetScope : scopeChain) {
|
||||||
Collection<DeclarationDescriptor> declarationsByLabel = jetScope.getDeclarationsByLabel(labelName);
|
Collection<DeclarationDescriptor> declarationsByLabel = jetScope.getDeclarationsByLabel(labelName);
|
||||||
if (!declarationsByLabel.isEmpty()) return declarationsByLabel; // TODO : merge?
|
if (!declarationsByLabel.isEmpty()) return declarationsByLabel; // TODO : merge?
|
||||||
@@ -169,4 +176,9 @@ public class ChainedScope implements JetScope {
|
|||||||
public Collection<DeclarationDescriptor> getOwnDeclaredDescriptors() {
|
public Collection<DeclarationDescriptor> getOwnDeclaredDescriptors() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return debugName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user