Skip to content

Commit

Permalink
fix codegen_view to return non-nested AST
Browse files Browse the repository at this point in the history
As title
  • Loading branch information
esc committed Jun 1, 2024
1 parent 57ca469 commit 3da4ece
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions numba_rvsdg/core/datastructures/ast_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,19 +744,13 @@ def codegen(self, block: Any) -> list[ast.AST]:
# blocks with multiple jump targets and all other regions must be
# visited linearly.
def codegen_view() -> list[Any]:
return [
self.codegen(b)
for b in block.subregion.concealed_region_view.values() # type: ignore # noqa
if not (type(b) is RegionBlock and b.kind == "branch")
]
r = []
for b in block.subregion.concealed_region_view.values(): # type: ignore # noqa
if not (type(b) is RegionBlock and b.kind == "branch"):
r.extend(self.codegen(b))
return r

# Head, tail and branch regions themselves to use the custom view
# above.
if block.kind == "head":
rval = codegen_view()
elif block.kind == "tail":
rval = codegen_view()
elif block.kind == "branch":
if block.kind in ("head", "tail", "branch"):
rval = codegen_view()
elif block.kind == "loop":
# A loop region gives rise to a Python while __loop_cont__
Expand Down

0 comments on commit 3da4ece

Please sign in to comment.