Fix function calls in with statements (#4245)

This commit is contained in:
Ryszard Rozak
2023-05-30 09:02:59 -04:00
committed by GitHub
parent 77502aeb97
commit 4f1f487ae4
5 changed files with 55 additions and 21 deletions
+9
View File
@@ -1371,6 +1371,15 @@ private:
iterateChildren(nodep);
}
}
void visit(AstWith* nodep) override {
if (nodep->user1SetOnce()) {
// Make sure that the return expression is converted only once
return;
}
AstNodeExpr* const withExprp = VN_AS(nodep->exprp()->unlinkFrBack(), NodeExpr);
nodep->addExprp(new AstCReturn{withExprp->fileline(), withExprp});
iterateChildren(nodep);
}
void visit(AstScope* nodep) override {
m_scopep = nodep;
m_insStmtp = nullptr;