From 98f75669a5da3099c3b1d82702d915035e2897f3 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 25 Jul 2019 17:55:25 +0300 Subject: [PATCH] [FIR] Make resolution sequence of CallKind static field --- .../kotlin/fir/resolve/calls/CallKind.kt | 47 ++++++++----------- .../resolve/calls/ResolutionStageRunner.kt | 2 +- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt index 63daf080b20..ef0ff27bbf2 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt @@ -6,37 +6,28 @@ package org.jetbrains.kotlin.fir.resolve.calls sealed class CallKind { - abstract fun sequence(): List + abstract val resolutionSequence: List object Function : CallKind() { - override fun sequence(): List { - return functionCallResolutionSequence() - } + override val resolutionSequence: List = listOf( + CheckVisibility, + MapArguments, + CheckExplicitReceiverConsistency, + CreateFreshTypeVariableSubstitutorStage, + CheckReceivers.Dispatch, + CheckReceivers.Extension, + CheckArguments + ) } object VariableAccess : CallKind() { - override fun sequence(): List { - return qualifiedAccessResolutionSequence() - } + override val resolutionSequence: List = 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 -) \ No newline at end of file +} \ No newline at end of file diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStageRunner.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStageRunner.kt index f600dcd60a0..2d1cc96bfa3 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStageRunner.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStageRunner.kt @@ -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 {