diff --git a/subprojects/frontends/c-frontend/src/main/java/hu/bme/mit/theta/frontend/transformation/grammar/function/FunctionVisitor.java b/subprojects/frontends/c-frontend/src/main/java/hu/bme/mit/theta/frontend/transformation/grammar/function/FunctionVisitor.java index 83adb2c0ed..4f9041fa08 100644 --- a/subprojects/frontends/c-frontend/src/main/java/hu/bme/mit/theta/frontend/transformation/grammar/function/FunctionVisitor.java +++ b/subprojects/frontends/c-frontend/src/main/java/hu/bme/mit/theta/frontend/transformation/grammar/function/FunctionVisitor.java @@ -566,7 +566,7 @@ private void resetPostStatements(CStatement statement) { private List 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 { @@ -587,7 +587,7 @@ private List 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(); } @@ -604,7 +604,7 @@ private List collectPostStatements(CStatement cStatement) { Stream.concat( getStatementList(cStatement.getPostStatements()).stream(), collectPostStatements(cStatement.getPostStatements()).stream()) - ).toList(); + ).filter(i -> !(i instanceof CExpr)).toList(); } else return List.of(); }