Internals: Fix recently added assertion false firing

This commit is contained in:
Wilson Snyder 2023-03-18 17:11:39 -04:00
parent 5f02f95ce6
commit 895ab8789b

View File

@ -673,19 +673,25 @@ private:
void unlinkAndClone(AstNodeFTask* funcp, AstNode* nodep, bool withNext) {
UASSERT_OBJ(nodep, funcp, "null in function object clone");
VNRelinker relinkHandle;
if (withNext) {
nodep->unlinkFrBackWithNext(&relinkHandle);
} else {
nodep->unlinkFrBack(&relinkHandle);
}
if (funcp->recursive()) {
VNRelinker relinkHandle;
if (withNext) {
nodep->unlinkFrBackWithNext(&relinkHandle);
} else {
nodep->unlinkFrBack(&relinkHandle);
}
// Recursive functions require the original argument list to
// still be live for linking purposes.
// The old function gets clone, so that node pointers are mostly
// retained through the V3Task transformations
AstNode* const newp = nodep->cloneTree(withNext);
relinkHandle.relink(newp);
} else {
if (withNext) {
nodep->unlinkFrBackWithNext();
} else {
nodep->unlinkFrBack();
}
}
}