Fix unpacked-in-class pattern assignment

This commit is contained in:
Wilson Snyder
2021-03-13 13:39:29 -05:00
parent e3788e871e
commit 9dcda6947d
3 changed files with 7 additions and 1 deletions
+3 -1
View File
@@ -67,6 +67,8 @@ class SliceVisitor final : public AstNVisitor {
nodep->v3error(
nodep->prettyTypeName()
<< " is not an unpacked array, but is in an unpacked array context");
} else {
V3Error::incErrors(); // Otherwise might infinite loop
}
m_assignError = true;
return nodep->cloneTree(false); // Likely will cause downstream errors
@@ -107,7 +109,7 @@ class SliceVisitor final : public AstNVisitor {
: offset));
newp = new AstArraySel(nodep->fileline(), snodep->fromp()->cloneTree(false), leOffset);
} else if (VN_IS(nodep, ArraySel) || VN_IS(nodep, NodeVarRef) || VN_IS(nodep, NodeSel)
|| VN_IS(nodep, CMethodHard)) {
|| VN_IS(nodep, CMethodHard) || VN_IS(nodep, MemberSel)) {
UINFO(9, " cloneSel(" << elements << "," << offset << ") " << nodep << endl);
int leOffset = !arrayp->rangep()->littleEndian()
? arrayp->rangep()->elementsConst() - 1 - offset