Skip to content

Commit

Permalink
Merge branch 'extraneous-goto' of github.com:spcl/dace into extraneou…
Browse files Browse the repository at this point in the history
…s-goto
  • Loading branch information
tbennun committed Aug 28, 2023
2 parents 29c9ed8 + 0392296 commit 4becc9d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions dace/codegen/control_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,15 +634,12 @@ def _find_next_block(block: ControlFlow) -> Optional[ControlFlow]:
"""
# Find block in parent
parent = block.parent
if parent is None:
return None
ind = next(i for i, b in enumerate(parent.children) if b is block)
if ind == len(parent.children) - 1 or isinstance(parent, (IfScope, IfElseChain, SwitchCaseScope)):
# If last block, or other children are not reachable from current node (branches),
# continue upwards

if parent is None: # Last block in root
return None

# Recursively continue upwards
# recursively continue upwards
return _find_next_block(parent)
return parent.children[ind + 1]

Expand Down

0 comments on commit 4becc9d

Please sign in to comment.