Removed 'implicit this' from scope for member lookup

This commit is contained in:
Svetlana Isakova
2014-06-24 17:38:13 +04:00
parent 067ac5c94a
commit 91b0ad2023
6 changed files with 17 additions and 18 deletions
@@ -262,16 +262,9 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
@NotNull
@Override
public List<ReceiverParameterDescriptor> getImplicitReceiversHierarchy() {
ReceiverParameterDescriptor receiver = getImplicitReceiver();
if (receiver != null) {
return Collections.singletonList(receiver);
}
return Collections.emptyList();
}
@Nullable
protected abstract ReceiverParameterDescriptor getImplicitReceiver();
// Do not change this, override in concrete subclasses:
// it is very easy to compromise laziness of this class, and fail all the debugging
// a generic implementation can't do this properly
@@ -243,6 +243,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
private JetScope computeScopeForMemberDeclarationResolution() {
WritableScopeImpl thisScope = new WritableScopeImpl(JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Scope with 'this' for " + getName());
thisScope.addLabeledDeclaration(this);
thisScope.setImplicitReceiver(this.getThisAsReceiverParameter());
thisScope.changeLockLevel(WritableScope.LockLevel.READING);
ClassDescriptor classObject = getClassObjectDescriptor();
@@ -326,12 +326,6 @@ public class LazyClassMemberScope extends AbstractLazyMemberScope<LazyClassDescr
return null;
}
@NotNull
@Override
protected ReceiverParameterDescriptor getImplicitReceiver() {
return thisDescriptor.getThisAsReceiverParameter();
}
@NotNull
public Set<ConstructorDescriptor> getConstructors() {
ConstructorDescriptor constructor = getPrimaryConstructor();
@@ -49,11 +49,6 @@ public class LazyPackageMemberScope extends AbstractLazyMemberScope<PackageFragm
return resolveSession.getScopeProvider().getFileScope(declaration.getContainingJetFile());
}
@Override
protected ReceiverParameterDescriptor getImplicitReceiver() {
return ReceiverParameterDescriptor.NO_RECEIVER_PARAMETER;
}
@Override
protected void getNonDeclaredFunctions(@NotNull Name name, @NotNull Set<FunctionDescriptor> result) {
// No extra functions