Skip to content

Commit

Permalink
Fix header generation when depth is -1 (#5501)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyedidia authored Jul 10, 2023
1 parent aaa15f8 commit 7267298
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/arcilator/arcilator-header-cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def format_view_hierarchy(hierarchy: StateHierarchy, depth: int) -> str:
lines = []
for state in hierarchy.states:
lines.append(f"{state_cpp_type(state)} &{clean_name(state.name)};")
if depth > 0:
if depth != 0:
for child in hierarchy.children:
lines.append(
f"{indent(format_view_hierarchy(child, depth-1))} {clean_name(child.name)};"
Expand All @@ -213,7 +213,7 @@ def format_view_constructor(hierarchy: StateHierarchy, depth: int) -> str:
lines = []
for state in hierarchy.states:
lines.append(f".{clean_name(state.name)} = {state_cpp_ref(state)}")
if depth > 0:
if depth != 0:
for child in hierarchy.children:
lines.append(
f".{clean_name(child.name)} = {indent(format_view_constructor(child, depth-1))}"
Expand Down

0 comments on commit 7267298

Please sign in to comment.