Skip to content

Commit

Permalink
Fixed pre- and post statements of nested ternary operators
Browse files Browse the repository at this point in the history
  • Loading branch information
leventeBajczi committed Oct 19, 2024
1 parent ad26bfb commit 8749d32
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ private void resetPostStatements(CStatement statement) {

private List<CStatement> getStatementList(CStatement statement) {
if (statement instanceof CCompound compound) {
return compound.getcStatementList();
return compound.getcStatementList().stream().flatMap(i -> getStatementList(i).stream()).toList();
} else if (statement != null) {
return List.of(statement);
} else {
Expand All @@ -587,7 +587,7 @@ private List<CStatement> collectPreStatements(CStatement cStatement) {
collectPreStatements(cStatement.getPreStatements()).stream(),
getStatementList(cStatement.getPreStatements()).stream()),
((CCompound) cStatement).getcStatementList().stream().flatMap(cStatement1 -> collectPreStatements(cStatement1).stream())
).toList();
).filter(i -> !(i instanceof CExpr)).toList();
} else return List.of();
}

Expand All @@ -604,7 +604,7 @@ private List<CStatement> collectPostStatements(CStatement cStatement) {
Stream.concat(
getStatementList(cStatement.getPostStatements()).stream(),
collectPostStatements(cStatement.getPostStatements()).stream())
).toList();
).filter(i -> !(i instanceof CExpr)).toList();
} else return List.of();
}

Expand Down

0 comments on commit 8749d32

Please sign in to comment.