Refactor DataFlowValueFactory into proper component
This commit is contained in:
@@ -38,6 +38,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getTextWithLocation
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.getDataFlowInfoBefore
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactoryImpl
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant
|
||||
import org.jetbrains.kotlin.resolve.constants.EnumValue
|
||||
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluator
|
||||
@@ -52,6 +53,7 @@ private constructor(private val whenExpression: KtWhenExpression, context: Trans
|
||||
private val type: KotlinType?
|
||||
private val uniqueConstants = mutableSetOf<Any>()
|
||||
private val uniqueEnumNames = mutableSetOf<String>()
|
||||
private val dataFlowValueFactory: DataFlowValueFactory = DataFlowValueFactoryImpl()
|
||||
|
||||
private val isExhaustive: Boolean
|
||||
get() {
|
||||
@@ -124,7 +126,7 @@ private constructor(private val whenExpression: KtWhenExpression, context: Trans
|
||||
val ktSubject = whenExpression.subjectExpression ?: return null
|
||||
val subjectType = bindingContext().getType(ktSubject) ?: return null
|
||||
|
||||
val dataFlow = DataFlowValueFactory.createDataFlowValue(
|
||||
val dataFlow = dataFlowValueFactory.createDataFlowValue(
|
||||
ktSubject, subjectType, bindingContext(), context().declarationDescriptor ?: context().currentModule)
|
||||
val languageVersionSettings = context().config.configuration.languageVersionSettings
|
||||
val expectedTypes = bindingContext().getDataFlowInfoBefore(ktSubject).getStableTypes(dataFlow, languageVersionSettings) +
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.getDataFlowInfoBefore
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
|
||||
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactoryImpl
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
import org.jetbrains.kotlin.types.expressions.OperatorConventions
|
||||
@@ -112,7 +112,7 @@ object EqualsBOIF : BinaryOperationIntrinsicFactory {
|
||||
val descriptor = context.declarationDescriptor ?: context.currentModule
|
||||
val ktType = bindingContext.getType(expression) ?: return null
|
||||
|
||||
val dataFlow = DataFlowValueFactory.createDataFlowValue(expression, ktType, bindingContext, descriptor)
|
||||
val dataFlow = DataFlowValueFactoryImpl().createDataFlowValue(expression, ktType, bindingContext, descriptor)
|
||||
val isPrimitiveFn = KotlinBuiltIns::isPrimitiveTypeOrNullablePrimitiveType
|
||||
|
||||
val languageVersionSettings = context.config.configuration.languageVersionSettings
|
||||
|
||||
Reference in New Issue
Block a user