DelegatingDataFlowInfo: do not create redundant instances
This commit is contained in:
+4
-5
@@ -277,10 +277,6 @@ internal class DelegatingDataFlowInfo private constructor(
|
|||||||
newTypeInfo.putAll(key, myTypeInfo[key].intersect(otherTypeInfo[key]))
|
newTypeInfo.putAll(key, myTypeInfo[key].intersect(otherTypeInfo[key]))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullabilityMapBuilder.isEmpty() && newTypeInfo.isEmpty) {
|
|
||||||
return DataFlowInfo.EMPTY
|
|
||||||
}
|
|
||||||
|
|
||||||
return create(null, ImmutableMap.copyOf(nullabilityMapBuilder), newTypeInfo)
|
return create(null, ImmutableMap.copyOf(nullabilityMapBuilder), newTypeInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,7 +296,7 @@ internal class DelegatingDataFlowInfo private constructor(
|
|||||||
// NB: typeInfo must be mutable here!
|
// NB: typeInfo must be mutable here!
|
||||||
typeInfo: SetMultimap<DataFlowValue, KotlinType>,
|
typeInfo: SetMultimap<DataFlowValue, KotlinType>,
|
||||||
valueWithGivenTypeInfo: DataFlowValue? = null
|
valueWithGivenTypeInfo: DataFlowValue? = null
|
||||||
): DelegatingDataFlowInfo {
|
): DataFlowInfo {
|
||||||
for (value in typeInfo.keys()) {
|
for (value in typeInfo.keys()) {
|
||||||
var iterator = typeInfo[value].iterator()
|
var iterator = typeInfo[value].iterator()
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -311,6 +307,9 @@ internal class DelegatingDataFlowInfo private constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (nullabilityInfo.isEmpty() && typeInfo.isEmpty && valueWithGivenTypeInfo == null) {
|
||||||
|
return parent ?: DataFlowInfoFactory.EMPTY
|
||||||
|
}
|
||||||
return DelegatingDataFlowInfo(parent, nullabilityInfo, typeInfo, valueWithGivenTypeInfo)
|
return DelegatingDataFlowInfo(parent, nullabilityInfo, typeInfo, valueWithGivenTypeInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user