[FIR] Make resolution sequence of CallKind static field

This commit is contained in:
Dmitriy Novozhilov
2019-07-25 17:55:25 +03:00
committed by Mikhail Glukhikh
parent 53404e5dac
commit 98f75669a5
2 changed files with 20 additions and 29 deletions
@@ -6,37 +6,28 @@
package org.jetbrains.kotlin.fir.resolve.calls
sealed class CallKind {
abstract fun sequence(): List<ResolutionStage>
abstract val resolutionSequence: List<ResolutionStage>
object Function : CallKind() {
override fun sequence(): List<ResolutionStage> {
return functionCallResolutionSequence()
}
override val resolutionSequence: List<ResolutionStage> = listOf(
CheckVisibility,
MapArguments,
CheckExplicitReceiverConsistency,
CreateFreshTypeVariableSubstitutorStage,
CheckReceivers.Dispatch,
CheckReceivers.Extension,
CheckArguments
)
}
object VariableAccess : CallKind() {
override fun sequence(): List<ResolutionStage> {
return qualifiedAccessResolutionSequence()
}
override val resolutionSequence: List<ResolutionStage> = listOf(
CheckVisibility,
DiscriminateSynthetics,
CheckExplicitReceiverConsistency,
CreateFreshTypeVariableSubstitutorStage,
CheckReceivers.Dispatch,
CheckReceivers.Extension
)
}
}
internal fun functionCallResolutionSequence() = listOf(
CheckVisibility,
MapArguments,
CheckExplicitReceiverConsistency,
CreateFreshTypeVariableSubstitutorStage,
CheckReceivers.Dispatch,
CheckReceivers.Extension,
CheckArguments
)
internal fun qualifiedAccessResolutionSequence() = listOf(
CheckVisibility,
DiscriminateSynthetics,
CheckExplicitReceiverConsistency,
CreateFreshTypeVariableSubstitutorStage,
CheckReceivers.Dispatch,
CheckReceivers.Extension
)
}
@@ -16,7 +16,7 @@ class ResolutionStageRunner(val components: InferenceComponents) {
val sink = CheckerSinkImpl(components)
var finished = false
sink.continuation = suspend {
for (stage in candidate.callInfo.callKind.sequence()) {
for (stage in candidate.callInfo.callKind.resolutionSequence) {
stage.check(candidate, sink, candidate.callInfo)
}
}.createCoroutineUnintercepted(completion = object : Continuation<Unit> {