Pseudocode: Use value usage map to decide if expression is effective statement

This commit is contained in:
Alexey Sedunov
2014-06-27 15:20:31 +04:00
parent 02342fce5d
commit 523beab902
@@ -49,7 +49,7 @@ fun JetExpression.isStatement(pseudocode: Pseudocode): Boolean {
val instruction = value.createdAt
if (considerUsedIfCreatedBeforeExit() && instruction.nextInstructions.any { it == pseudocode.getExitInstruction() }) return false
return traverseFollowingInstructions(instruction, HashSet(), TraversalOrder.FORWARD) { value !in it.inputValues }
return pseudocode.getUsages(pseudocode.getElementValue(this)).isEmpty()
}
val PseudoValue.implicitReturnValue: Boolean