Fix assign to input var in methods (#4367)

This commit is contained in:
Aleksander Kiryk
2023-07-17 09:52:37 -04:00
committed by GitHub
parent f7d09c671a
commit 5a694ccb8a
3 changed files with 31 additions and 7 deletions
+2 -7
View File
@@ -41,7 +41,6 @@ private:
bool m_setContinuously = false; // Set that var has some continuous assignment
bool m_setStrengthSpecified = false; // Set that var has assignment with strength specified.
VAccess m_setRefLvalue; // Set VarRefs to lvalues for pin assignments
AstNodeFTask* m_ftaskp = nullptr; // Function or task we're inside
// VISITs
// Result handing
@@ -55,7 +54,8 @@ private:
// so it is needed to check only if m_setContinuously is true
if (m_setStrengthSpecified) nodep->varp()->hasStrengthAssignment(true);
}
if (nodep->access().isWriteOrRW() && !m_ftaskp && nodep->varp()->isReadOnly()) {
if (nodep->access().isWriteOrRW() && !nodep->varp()->isFuncLocal()
&& nodep->varp()->isReadOnly()) {
nodep->v3warn(ASSIGNIN,
"Assigning to input/const variable: " << nodep->prettyNameQ());
}
@@ -285,11 +285,6 @@ private:
}
iterateChildren(nodep);
}
void visit(AstNodeFTask* nodep) override {
VL_RESTORER(m_ftaskp);
m_ftaskp = nodep;
iterateChildren(nodep);
}
void visit(AstNodeFTaskRef* nodep) override {
AstNode* pinp = nodep->pinsp();
const AstNodeFTask* const taskp = nodep->taskp();