Accept renaming and formating requests
* Rename "resolve" into "resolveCandidates" * Use multi-line formatting for formal parameters * Move ")" down one line at call sites
This commit is contained in:
committed by
Denis Zharkov
parent
bf08755969
commit
eb7d77ebd9
+19
-10
@@ -63,7 +63,12 @@ interface SimpleScopeTowerProcessor<out C> : ScopeTowerProcessor<C> {
|
|||||||
internal abstract class AbstractSimpleScopeTowerProcessor<C : Candidate>(
|
internal abstract class AbstractSimpleScopeTowerProcessor<C : Candidate>(
|
||||||
val candidateFactory: CandidateFactory<C>
|
val candidateFactory: CandidateFactory<C>
|
||||||
) : SimpleScopeTowerProcessor<C> {
|
) : SimpleScopeTowerProcessor<C> {
|
||||||
fun resolve(collector: Collection<CandidateWithBoundDispatchReceiver>, f:(Boolean)->Boolean, kind: ExplicitReceiverKind, receiver: ReceiverValueWithSmartCastInfo?) : Collection<C> {
|
fun createCandidates(
|
||||||
|
collector: Collection<CandidateWithBoundDispatchReceiver>,
|
||||||
|
f:(Boolean)->Boolean,
|
||||||
|
kind: ExplicitReceiverKind,
|
||||||
|
receiver: ReceiverValueWithSmartCastInfo?
|
||||||
|
) : Collection<C> {
|
||||||
val result = mutableListOf<C>()
|
val result = mutableListOf<C>()
|
||||||
for (candidate in collector) {
|
for (candidate in collector) {
|
||||||
if (f(candidate.requiresExtensionReceiver)) {
|
if (f(candidate.requiresExtensionReceiver)) {
|
||||||
@@ -91,16 +96,18 @@ internal class ExplicitReceiverScopeTowerProcessor<C : Candidate>(
|
|||||||
) : AbstractSimpleScopeTowerProcessor<C>(context) {
|
) : AbstractSimpleScopeTowerProcessor<C>(context) {
|
||||||
override fun simpleProcess(data: TowerData): Collection<C> {
|
override fun simpleProcess(data: TowerData): Collection<C> {
|
||||||
return when (data) {
|
return when (data) {
|
||||||
TowerData.Empty -> resolve(
|
TowerData.Empty -> createCandidates(
|
||||||
MemberScopeTowerLevel(scopeTower, explicitReceiver).collectCandidates(null),
|
MemberScopeTowerLevel(scopeTower, explicitReceiver).collectCandidates(null),
|
||||||
{ !it },
|
{ !it },
|
||||||
ExplicitReceiverKind.DISPATCH_RECEIVER,
|
ExplicitReceiverKind.DISPATCH_RECEIVER,
|
||||||
null)
|
null
|
||||||
is TowerData.TowerLevel -> resolve(
|
)
|
||||||
|
is TowerData.TowerLevel -> createCandidates(
|
||||||
data.level.collectCandidates(explicitReceiver),
|
data.level.collectCandidates(explicitReceiver),
|
||||||
{ it },
|
{ it },
|
||||||
ExplicitReceiverKind.EXTENSION_RECEIVER,
|
ExplicitReceiverKind.EXTENSION_RECEIVER,
|
||||||
explicitReceiver)
|
explicitReceiver
|
||||||
|
)
|
||||||
else -> emptyList()
|
else -> emptyList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +130,7 @@ private class QualifierScopeTowerProcessor<C : Candidate>(
|
|||||||
override fun simpleProcess(data: TowerData): Collection<C> {
|
override fun simpleProcess(data: TowerData): Collection<C> {
|
||||||
if (data != TowerData.Empty) return emptyList()
|
if (data != TowerData.Empty) return emptyList()
|
||||||
|
|
||||||
return resolve(
|
return createCandidates(
|
||||||
QualifierScopeTowerLevel(scopeTower, qualifier).collectCandidates(null),
|
QualifierScopeTowerLevel(scopeTower, qualifier).collectCandidates(null),
|
||||||
{ !it },
|
{ !it },
|
||||||
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
||||||
@@ -140,16 +147,18 @@ private class NoExplicitReceiverScopeTowerProcessor<C : Candidate>(
|
|||||||
val collectCandidates: CandidatesCollector
|
val collectCandidates: CandidatesCollector
|
||||||
) : AbstractSimpleScopeTowerProcessor<C>(context) {
|
) : AbstractSimpleScopeTowerProcessor<C>(context) {
|
||||||
override fun simpleProcess(data: TowerData): Collection<C> = when (data) {
|
override fun simpleProcess(data: TowerData): Collection<C> = when (data) {
|
||||||
is TowerData.TowerLevel -> resolve(
|
is TowerData.TowerLevel -> createCandidates(
|
||||||
data.level.collectCandidates(null),
|
data.level.collectCandidates(null),
|
||||||
{ !it },
|
{ !it },
|
||||||
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
||||||
null)
|
null
|
||||||
is TowerData.BothTowerLevelAndImplicitReceiver -> resolve(
|
)
|
||||||
|
is TowerData.BothTowerLevelAndImplicitReceiver -> createCandidates(
|
||||||
data.level.collectCandidates(data.implicitReceiver),
|
data.level.collectCandidates(data.implicitReceiver),
|
||||||
{ it },
|
{ it },
|
||||||
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
ExplicitReceiverKind.NO_EXPLICIT_RECEIVER,
|
||||||
data.implicitReceiver)
|
data.implicitReceiver
|
||||||
|
)
|
||||||
else -> emptyList()
|
else -> emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user