Get rid of affectReceiver parameter in DelegatingDataFlow::putNullabilityAndTypeInfo
The only non-default argument was inside "assign" method And it can be replaced with simple map instantiation
This commit is contained in:
+4
-6
@@ -64,7 +64,6 @@ internal class DelegatingDataFlowInfo private constructor(
|
||||
nullability: Nullability,
|
||||
languageVersionSettings: LanguageVersionSettings,
|
||||
newTypeInfoBuilder: SetMultimap<DataFlowValue, KotlinType>? = null,
|
||||
affectReceiver: Boolean = true,
|
||||
// TODO: remove me in version 1.3! I'm very dirty hack!
|
||||
// In normal circumstances this should be always true
|
||||
recordUnstable: Boolean = true
|
||||
@@ -74,8 +73,7 @@ internal class DelegatingDataFlowInfo private constructor(
|
||||
}
|
||||
|
||||
val identifierInfo = value.identifierInfo
|
||||
if (affectReceiver && !nullability.canBeNull() &&
|
||||
languageVersionSettings.supportsFeature(LanguageFeature.SafeCallBoundSmartCasts)) {
|
||||
if (!nullability.canBeNull() && languageVersionSettings.supportsFeature(LanguageFeature.SafeCallBoundSmartCasts)) {
|
||||
when (identifierInfo) {
|
||||
is IdentifierInfo.Qualified -> {
|
||||
val receiverType = identifierInfo.receiverType
|
||||
@@ -113,6 +111,7 @@ internal class DelegatingDataFlowInfo private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun getCollectedTypes(key: DataFlowValue, languageVersionSettings: LanguageVersionSettings) =
|
||||
getCollectedTypes(key, true, languageVersionSettings)
|
||||
|
||||
@@ -169,9 +168,8 @@ internal class DelegatingDataFlowInfo private constructor(
|
||||
}
|
||||
|
||||
override fun assign(a: DataFlowValue, b: DataFlowValue, languageVersionSettings: LanguageVersionSettings): DataFlowInfo {
|
||||
val nullability = hashMapOf<DataFlowValue, Nullability>()
|
||||
val nullabilityOfB = getStableNullability(b)
|
||||
putNullabilityAndTypeInfo(nullability, a, nullabilityOfB, languageVersionSettings, affectReceiver = false)
|
||||
val nullabilityUpdate = mapOf(a to nullabilityOfB)
|
||||
|
||||
var typesForB = getStableTypes(b, languageVersionSettings)
|
||||
// Own type of B must be recorded separately, e.g. for a constant
|
||||
@@ -182,7 +180,7 @@ internal class DelegatingDataFlowInfo private constructor(
|
||||
typesForB += b.type
|
||||
}
|
||||
|
||||
return create(this, nullability, listOf(Tuple2(a, typesForB)), a)
|
||||
return create(this, nullabilityUpdate, listOf(Tuple2(a, typesForB)), a)
|
||||
}
|
||||
|
||||
override fun equate(
|
||||
|
||||
Reference in New Issue
Block a user