From 371b8310d9ca49ae6fceb258ce85cf3f7692e4cf Mon Sep 17 00:00:00 2001 From: Ryszard Rozak Date: Fri, 17 Mar 2023 13:25:39 +0100 Subject: [PATCH] Support method calls without parenthesis (#4034) * Support method class without parenthesis Signed-off-by: Ryszard Rozak * Delete replaced nodes Signed-off-by: Ryszard Rozak --------- Signed-off-by: Ryszard Rozak --- src/V3Width.cpp | 8 ++++++++ test_regress/t/t_class_method.v | 1 + 2 files changed, 9 insertions(+) diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 70ced22a4..7e556bca6 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -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); diff --git a/test_regress/t/t_class_method.v b/test_regress/t/t_class_method.v index feda390fd..b1aefcb5d 100644 --- a/test_regress/t/t_class_method.v +++ b/test_regress/t/t_class_method.v @@ -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