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,
|
nullability: Nullability,
|
||||||
languageVersionSettings: LanguageVersionSettings,
|
languageVersionSettings: LanguageVersionSettings,
|
||||||
newTypeInfoBuilder: SetMultimap<DataFlowValue, KotlinType>? = null,
|
newTypeInfoBuilder: SetMultimap<DataFlowValue, KotlinType>? = null,
|
||||||
affectReceiver: Boolean = true,
|
|
||||||
// TODO: remove me in version 1.3! I'm very dirty hack!
|
// TODO: remove me in version 1.3! I'm very dirty hack!
|
||||||
// In normal circumstances this should be always true
|
// In normal circumstances this should be always true
|
||||||
recordUnstable: Boolean = true
|
recordUnstable: Boolean = true
|
||||||
@@ -74,8 +73,7 @@ internal class DelegatingDataFlowInfo private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val identifierInfo = value.identifierInfo
|
val identifierInfo = value.identifierInfo
|
||||||
if (affectReceiver && !nullability.canBeNull() &&
|
if (!nullability.canBeNull() && languageVersionSettings.supportsFeature(LanguageFeature.SafeCallBoundSmartCasts)) {
|
||||||
languageVersionSettings.supportsFeature(LanguageFeature.SafeCallBoundSmartCasts)) {
|
|
||||||
when (identifierInfo) {
|
when (identifierInfo) {
|
||||||
is IdentifierInfo.Qualified -> {
|
is IdentifierInfo.Qualified -> {
|
||||||
val receiverType = identifierInfo.receiverType
|
val receiverType = identifierInfo.receiverType
|
||||||
@@ -113,6 +111,7 @@ internal class DelegatingDataFlowInfo private constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun getCollectedTypes(key: DataFlowValue, languageVersionSettings: LanguageVersionSettings) =
|
override fun getCollectedTypes(key: DataFlowValue, languageVersionSettings: LanguageVersionSettings) =
|
||||||
getCollectedTypes(key, true, languageVersionSettings)
|
getCollectedTypes(key, true, languageVersionSettings)
|
||||||
|
|
||||||
@@ -169,9 +168,8 @@ internal class DelegatingDataFlowInfo private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun assign(a: DataFlowValue, b: DataFlowValue, languageVersionSettings: LanguageVersionSettings): DataFlowInfo {
|
override fun assign(a: DataFlowValue, b: DataFlowValue, languageVersionSettings: LanguageVersionSettings): DataFlowInfo {
|
||||||
val nullability = hashMapOf<DataFlowValue, Nullability>()
|
|
||||||
val nullabilityOfB = getStableNullability(b)
|
val nullabilityOfB = getStableNullability(b)
|
||||||
putNullabilityAndTypeInfo(nullability, a, nullabilityOfB, languageVersionSettings, affectReceiver = false)
|
val nullabilityUpdate = mapOf(a to nullabilityOfB)
|
||||||
|
|
||||||
var typesForB = getStableTypes(b, languageVersionSettings)
|
var typesForB = getStableTypes(b, languageVersionSettings)
|
||||||
// Own type of B must be recorded separately, e.g. for a constant
|
// 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
|
typesForB += b.type
|
||||||
}
|
}
|
||||||
|
|
||||||
return create(this, nullability, listOf(Tuple2(a, typesForB)), a)
|
return create(this, nullabilityUpdate, listOf(Tuple2(a, typesForB)), a)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun equate(
|
override fun equate(
|
||||||
|
|||||||
Reference in New Issue
Block a user