Extract KotlinCallKind into separate file

This commit is contained in:
Victor Petukhov
2021-09-20 15:09:19 +03:00
parent 4559558001
commit f1803b49fe
2 changed files with 64 additions and 47 deletions
@@ -0,0 +1,64 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.resolve.calls.model
import org.jetbrains.kotlin.resolve.calls.components.ArgumentsToCandidateParameterDescriptor
import org.jetbrains.kotlin.resolve.calls.components.CheckArgumentsInParenthesis
import org.jetbrains.kotlin.resolve.calls.components.CheckCallableReference
import org.jetbrains.kotlin.resolve.calls.components.CheckExplicitReceiverKindConsistency
import org.jetbrains.kotlin.resolve.calls.components.CheckExternalArgument
import org.jetbrains.kotlin.resolve.calls.components.CheckInfixResolutionPart
import org.jetbrains.kotlin.resolve.calls.components.CheckOperatorResolutionPart
import org.jetbrains.kotlin.resolve.calls.components.CheckReceivers
import org.jetbrains.kotlin.resolve.calls.components.CheckSuperExpressionCallPart
import org.jetbrains.kotlin.resolve.calls.components.CheckVisibility
import org.jetbrains.kotlin.resolve.calls.components.CollectionTypeVariableUsagesInfo
import org.jetbrains.kotlin.resolve.calls.components.CompatibilityOfPartiallyApplicableSamConversion
import org.jetbrains.kotlin.resolve.calls.components.CompatibilityOfTypeVariableAsIntersectionTypePart
import org.jetbrains.kotlin.resolve.calls.components.CreateFreshVariablesSubstitutor
import org.jetbrains.kotlin.resolve.calls.components.EagerResolveOfCallableReferences
import org.jetbrains.kotlin.resolve.calls.components.MapArguments
import org.jetbrains.kotlin.resolve.calls.components.MapTypeArguments
import org.jetbrains.kotlin.resolve.calls.components.NoArguments
import org.jetbrains.kotlin.resolve.calls.components.NoTypeArguments
import org.jetbrains.kotlin.resolve.calls.components.PostponedVariablesInitializerResolutionPart
enum class KotlinCallKind(vararg resolutionPart: ResolutionPart) {
VARIABLE(
CheckVisibility,
CheckSuperExpressionCallPart,
NoTypeArguments,
NoArguments,
CreateFreshVariablesSubstitutor,
CollectionTypeVariableUsagesInfo,
CheckExplicitReceiverKindConsistency,
CheckReceivers,
PostponedVariablesInitializerResolutionPart
),
FUNCTION(
CheckVisibility,
CheckInfixResolutionPart,
CheckOperatorResolutionPart,
CheckSuperExpressionCallPart,
MapTypeArguments,
MapArguments,
ArgumentsToCandidateParameterDescriptor,
CreateFreshVariablesSubstitutor,
CollectionTypeVariableUsagesInfo,
CheckExplicitReceiverKindConsistency,
CheckReceivers,
CheckArgumentsInParenthesis,
CheckExternalArgument,
EagerResolveOfCallableReferences,
CompatibilityOfTypeVariableAsIntersectionTypePart,
CompatibilityOfPartiallyApplicableSamConversion,
PostponedVariablesInitializerResolutionPart
),
INVOKE(*FUNCTION.resolutionSequence.toTypedArray()),
UNSUPPORTED();
val resolutionSequence = resolutionPart.asList()
}
@@ -47,53 +47,6 @@ class KotlinCallComponents(
val callableReferenceArgumentResolver: CallableReferenceArgumentResolver
)
enum class KotlinCallKind(vararg resolutionPart: ResolutionPart) {
VARIABLE(
CheckVisibility,
CheckSuperExpressionCallPart,
NoTypeArguments,
NoArguments,
CreateFreshVariablesSubstitutor,
CollectionTypeVariableUsagesInfo,
CheckExplicitReceiverKindConsistency,
CheckReceivers,
PostponedVariablesInitializerResolutionPart
),
FUNCTION(
CheckVisibility,
CheckInfixResolutionPart,
CheckOperatorResolutionPart,
CheckSuperExpressionCallPart,
MapTypeArguments,
MapArguments,
ArgumentsToCandidateParameterDescriptor,
CreateFreshVariablesSubstitutor,
CollectionTypeVariableUsagesInfo,
CheckExplicitReceiverKindConsistency,
CheckReceivers,
CheckArgumentsInParenthesis,
CheckExternalArgument,
EagerResolveOfCallableReferences,
CompatibilityOfTypeVariableAsIntersectionTypePart,
CompatibilityOfPartiallyApplicableSamConversion,
PostponedVariablesInitializerResolutionPart
),
INVOKE(*FUNCTION.resolutionSequence.toTypedArray()),
CALLABLE_REFERENCE(
CheckVisibility,
NoTypeArguments,
NoArguments,
CreateFreshVariablesSubstitutor,
CollectionTypeVariableUsagesInfo,
CheckReceivers,
CheckCallableReference,
CompatibilityOfTypeVariableAsIntersectionTypePart
),
UNSUPPORTED();
val resolutionSequence = resolutionPart.asList()
}
class GivenCandidate(
val descriptor: FunctionDescriptor,
val dispatchReceiver: ReceiverValueWithSmartCastInfo?,