Fix multidimensional function return value selects (#5382).

This commit is contained in:
Wilson Snyder
2024-09-09 19:56:09 -04:00
parent 434896d50c
commit 4e4fdd3b66
5 changed files with 72 additions and 27 deletions
+17
View File
@@ -128,6 +128,23 @@ AstRange* V3ParseGrammar::scrubRange(AstNodeRange* nrangep) {
return VN_CAST(nrangep, Range);
}
AstNodePreSel* V3ParseGrammar::scrubSel(AstNodeExpr* fromp, AstNodePreSel* selp) VL_MT_DISABLED {
// SEL(PARSELVALUE, ...) -> SEL(fromp, ...)
AstNodePreSel* subSelp = selp;
while (true) {
if (VN_IS(subSelp->fromp(), ParseHolder)) break;
if (AstNodePreSel* const lowerSelp = VN_CAST(subSelp->fromp(), NodePreSel)) {
subSelp = lowerSelp;
continue;
}
subSelp->v3fatalSrc("Couldn't find where to insert expression into select");
}
AstNode* subSelFromp = subSelp->fromp();
subSelFromp->replaceWith(fromp);
VL_DO_DANGLING(subSelFromp->deleteTree(), subSelFromp);
return selp;
}
AstNodeDType* V3ParseGrammar::createArray(AstNodeDType* basep, AstNodeRange* nrangep,
bool isPacked) {
// Split RANGE0-RANGE1-RANGE2