mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
[extract method] IDEA-262123: return default variable value on unconditional exits
GitOrigin-RevId: eaf46751769ecddd3711de96c48b62f209878b27
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7c0af63e54
commit
ac42764da7
@@ -32,7 +32,8 @@ class BodyBuilder(private val factory: PsiElementFactory) {
|
||||
is EmptyOutput -> throw IllegalStateException()
|
||||
}
|
||||
is UnconditionalFlow -> when (dataOutput) {
|
||||
is VariableOutput, is EmptyOutput -> "return;"
|
||||
is VariableOutput -> "return ${dataOutput.variable.name};"
|
||||
is EmptyOutput -> "return;"
|
||||
is ExpressionOutput -> "return $returnExpression;"
|
||||
ArtificialBooleanOutput -> throw IllegalStateException()
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ fun findExtractOptions(elements: List<PsiElement>, inferNullity: Boolean = true)
|
||||
variableData.nullability != Nullability.NOT_NULL && flowOutput is ConditionalFlow -> null
|
||||
flowOutput is ConditionalFlow && ! canExtractStatementsFromScope(flowOutput.statements, elements) -> null
|
||||
flowOutput is ConditionalFlow -> variableData.copy(nullability = Nullability.NULLABLE)
|
||||
flowOutput is UnconditionalFlow -> null
|
||||
else -> variableData
|
||||
}
|
||||
else -> findFlowData(analyzer, flowOutput)
|
||||
|
||||
Reference in New Issue
Block a user