Fix coroutine trace setters (#7078 repair) (#7296)

This commit is contained in:
Igor Zaworski
2026-03-20 09:23:32 -07:00
committed by GitHub
parent 331cac2054
commit c3fc0d9f0f
4 changed files with 82 additions and 4 deletions
+2 -4
View File
@@ -467,10 +467,8 @@ class TraceVisitor final : public VNVisitor {
} else if (AstCFunc* const funcp = VN_CAST(insertp, CFunc)) {
// If there are awaits, insert the setter after each await
if (funcp->isCoroutine() && funcp->stmtsp()) {
funcp->stmtsp()->foreachAndNext([&](AstCAwait* awaitp) {
AstNode* stmtp = awaitp->backp();
while (VN_IS(stmtp, NodeExpr)) stmtp = stmtp->backp();
stmtp->addNextHere(setterp->cloneTree(false));
funcp->stmtsp()->foreachAndNext([setterp](AstCAwait* awaitp) {
awaitp->addNextHere(setterp->cloneTree(false));
});
}
funcp->addStmtsp(setterp);