Support method calls without parenthesis (#4034)

* Support method class without parenthesis

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>

* Delete replaced nodes

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>

---------

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
This commit is contained in:
Ryszard Rozak 2023-03-17 13:25:39 +01:00 committed by GitHub
parent 1ac721af8f
commit 371b8310d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -2667,6 +2667,14 @@ private:
}
if (AstEnumItemRef* const adfoundp = VN_CAST(foundp, EnumItemRef)) {
nodep->replaceWith(adfoundp->cloneTree(false));
VL_DO_DANGLING(pushDeletep(nodep), nodep);
return;
}
if (AstNodeFTask* const methodp = VN_CAST(foundp, NodeFTask)) {
nodep->replaceWith(new AstMethodCall{nodep->fileline(),
nodep->fromp()->unlinkFrBack(),
nodep->name(), nullptr});
VL_DO_DANGLING(pushDeletep(nodep), nodep);
return;
}
UINFO(1, "found object " << foundp << endl);

View File

@ -24,6 +24,7 @@ module t (/*AUTOARG*/);
if (c.get_methoda() != 20) $stop;
c.setv_methoda(30);
if (c.get_methoda() != 30) $stop;
if (c.get_methoda != 30) $stop;
$write("*-* All Finished *-*\n");
$finish;
end