Remove useless parameter
It seems a candidate is added either when requiresExtensionReceiver is true and receiver is not null or when requiresExtensionReceiver is false and receiver is null. Consequently, f appears useless.
This commit is contained in:
committed by
Denis Zharkov
parent
eb7d77ebd9
commit
813d7ff84a
+1
-7
@@ -65,13 +65,12 @@ internal abstract class AbstractSimpleScopeTowerProcessor<C : Candidate>(
|
|||||||
) : SimpleScopeTowerProcessor<C> {
|
) : SimpleScopeTowerProcessor<C> {
|
||||||
fun createCandidates(
|
fun createCandidates(
|
||||||
collector: Collection<CandidateWithBoundDispatchReceiver>,
|
collector: Collection<CandidateWithBoundDispatchReceiver>,
|
||||||
f:(Boolean)->Boolean,
|
|
||||||
kind: ExplicitReceiverKind,
|
kind: ExplicitReceiverKind,
|
||||||
receiver: ReceiverValueWithSmartCastInfo?
|
receiver: ReceiverValueWithSmartCastInfo?
|
||||||
) : Collection<C> {
|
) : Collection<C> {
|
||||||
val result = mutableListOf<C>()
|
val result = mutableListOf<C>()
|
||||||
for (candidate in collector) {
|
for (candidate in collector) {
|
||||||
if (f(candidate.requiresExtensionReceiver)) {
|
if (candidate.requiresExtensionReceiver == (receiver != null)) {
|
||||||
result.add(
|
result.add(
|
||||||
candidateFactory.createCandidate(
|
candidateFactory.createCandidate(
|
||||||
candidate,
|
candidate,
|
||||||
@@ -98,13 +97,11 @@ internal class ExplicitReceiverScopeTowerProcessor<C : Candidate>(
|
|||||||
return when (data) {
|
return when (data) {
|
||||||
TowerData.Empty -> createCandidates(
|
TowerData.Empty -> createCandidates(
|
||||||
MemberScopeTowerLevel(scopeTower, explicitReceiver).collectCandidates(null),
|
MemberScopeTowerLevel(scopeTower, explicitReceiver).collectCandidates(null),
|
||||||
{ !it },
|
|
||||||
ExplicitReceiverKind.DISPATCH_RECEIVER,
|
ExplicitReceiverKind.DISPATCH_RECEIVER,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
is TowerData.TowerLevel -> createCandidates(
|
is TowerData.TowerLevel -> createCandidates(
|
||||||
data.level.collectCandidates(explicitReceiver),
|
data.level.collectCandidates(explicitReceiver),
|
||||||
{ it },
|
|
||||||
ExplicitReceiverKind.EXTENSION_RECEIVER,
|
ExplicitReceiverKind.EXTENSION_RECEIVER,
|
||||||
explicitReceiver
|
explicitReceiver
|
||||||
)
|
)
|
||||||
@@ -132,7 +129,6 @@ private class QualifierScopeTowerProcessor<C : Candidate>(
|
|||||||
|
|
||||||
return createCandidates(
|
return createCandidates(
|
||||||
QualifierScopeTowerLevel(scopeTower, qualifier).collectCandidates(null),
|
QualifierScopeTowerLevel(scopeTower, qualifier).collectCandidates(null),
|
||||||
{ !it },
|
|
||||||
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
@@ -149,13 +145,11 @@ private class NoExplicitReceiverScopeTowerProcessor<C : Candidate>(
|
|||||||
override fun simpleProcess(data: TowerData): Collection<C> = when (data) {
|
override fun simpleProcess(data: TowerData): Collection<C> = when (data) {
|
||||||
is TowerData.TowerLevel -> createCandidates(
|
is TowerData.TowerLevel -> createCandidates(
|
||||||
data.level.collectCandidates(null),
|
data.level.collectCandidates(null),
|
||||||
{ !it },
|
|
||||||
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
is TowerData.BothTowerLevelAndImplicitReceiver -> createCandidates(
|
is TowerData.BothTowerLevelAndImplicitReceiver -> createCandidates(
|
||||||
data.level.collectCandidates(data.implicitReceiver),
|
data.level.collectCandidates(data.implicitReceiver),
|
||||||
{ it },
|
|
||||||
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
||||||
data.implicitReceiver
|
data.implicitReceiver
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user