Fix some issues in MutableBlockStmtGraph
#708
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
removeNode
had multiple issues withkeepFlow = true
(which is the default).It would remove too many edges and also treated the flow inside a block and the flow between blocks differently.
This also caused the issue with the
DeadAssignmentEliminator
that resulted in an invalid statement graph.Added a test for the issue with the DeadAssignmentEliminator producing an invalid statement graph.
removeNode
withkeepFlow = true
will now remove the statement and connect all predecessors of the statement with the successor of the statement to maintain the flow. The method will also throw anIllegalArgumentException
when the statement to be removed has multiple successors (a branching statement), because the semantics of "keeping the flow" are not unambiguous here.removeEdge
didn't split blocks correctly and removed too many edges between blocks. This was also fixed. Also removedremoveBlockBorderEdgesInternal
. This implemented somewhat complicated logic that was easier to move inside ofremoveEdge
.