DataFlowInfo Refactoring: getNullability() --> getCollectedNullability(); getPossibleTypes() --> getCollectedTypes()

This commit is contained in:
Mikhail Glukhikh
2015-12-08 11:21:10 +03:00
parent 57b3bc0496
commit d08f6f8238
9 changed files with 24 additions and 24 deletions
@@ -128,7 +128,7 @@ fun KtExpression.guessTypes(
val theType1 = context.getType(this)
if (theType1 != null) {
val dataFlowInfo = context.getDataFlowInfo(this)
val possibleTypes = dataFlowInfo.getPossibleTypes(DataFlowValueFactory.createDataFlowValue(this, theType1, context, module))
val possibleTypes = dataFlowInfo.getCollectedTypes(DataFlowValueFactory.createDataFlowValue(this, theType1, context, module))
return if (possibleTypes.isNotEmpty()) possibleTypes.toTypedArray() else arrayOf(theType1)
}
@@ -182,13 +182,13 @@ data class ExtractionData(
val dataFlowInfo = context.getDataFlowInfo(expression)
(resolvedCall?.getImplicitReceiverValue() as? ImplicitReceiver)?.let {
return dataFlowInfo.getPossibleTypes(DataFlowValueFactory.createDataFlowValueForStableReceiver(it))
return dataFlowInfo.getCollectedTypes(DataFlowValueFactory.createDataFlowValueForStableReceiver(it))
}
val type = resolvedCall?.resultingDescriptor?.returnType ?: return emptySet()
val containingDescriptor = expression.getResolutionScope(context, expression.getResolutionFacade()).ownerDescriptor
val dataFlowValue = DataFlowValueFactory.createDataFlowValue(expression, type, context, containingDescriptor)
return dataFlowInfo.getPossibleTypes(dataFlowValue)
return dataFlowInfo.getCollectedTypes(dataFlowValue)
}
fun getBrokenReferencesInfo(body: KtBlockExpression): List<ResolvedReferenceInfo> {
@@ -313,7 +313,7 @@ private fun suggestParameterType(
receiverToExtract is ImplicitReceiver -> {
val typeByDataFlowInfo = if (useSmartCastsIfPossible) {
val dataFlowInfo = bindingContext.getDataFlowInfo(resolvedCall!!.call.callElement)
val possibleTypes = dataFlowInfo.getPossibleTypes(DataFlowValueFactory.createDataFlowValueForStableReceiver(receiverToExtract))
val possibleTypes = dataFlowInfo.getCollectedTypes(DataFlowValueFactory.createDataFlowValueForStableReceiver(receiverToExtract))
if (possibleTypes.isNotEmpty()) CommonSupertypes.commonSupertype(possibleTypes) else null
} else null
typeByDataFlowInfo ?: receiverToExtract.type