Skip to content

Commit

Permalink
Accept suggestion from Review
Browse files Browse the repository at this point in the history
Signed-off-by: Shreyas Khandekar <[email protected]>

Co-authored-by: Daniel <[email protected]>
  • Loading branch information
ShreyasKhandekar and DanilaFe authored Nov 4, 2024
1 parent 56d99be commit f733e41
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions tools/chplcheck/src/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,23 +557,21 @@ def append_nested_single_stmt(node, prev: List[AstNode]):
if isinstance(node, Loop) and node.block_style() == "implicit":
children = list(node)
# safe to access [-1], loops must have at least 1 child
for blockchild in reversed(list(children[-1])):
if isinstance(blockchild, Comment):
continue
if might_incorrectly_report_location(blockchild):
continue
prev.append(blockchild)
append_nested_single_stmt(blockchild, prev)
return node # Return the outermost loop to use an anchor
inblock = reversed(list(children[-1]))
elif isinstance(node, On) and node.block_style() == "implicit":
for stmt in node.stmts():
if isinstance(stmt, Comment):
continue
if might_incorrectly_report_location(stmt):
continue
prev.append(stmt)
append_nested_single_stmt(stmt, prev)
return node # Return the outermost on to use an anchor
inblock = node.stmts()
else:
# Should we also check for Conditionals here?
return None
for stmt in inblock:
if isinstance(stmt, Comment):
continue
if might_incorrectly_report_location(stmt):
continue
prev.append(stmt)
append_nested_single_stmt(stmt, prev)
return node # Return the outermost on to use an anchor

# Should we also check for Conditionals here?
return None

Expand Down

0 comments on commit f733e41

Please sign in to comment.