From 09ca4ce7915cd7c6817c041e21577154ea14dda3 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 17 Nov 2019 08:43:04 -0500 Subject: [PATCH] Internals: Assert proper AstArgs in place. --- src/V3Width.cpp | 19 ++++++++++++------- src/verilog.y | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 85c6d8a7f..74f58eec6 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -1661,7 +1661,10 @@ private: } void methodOkArguments(AstMethodSel* nodep, int minArg, int maxArg) { int narg = 0; - for (AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp()) ++narg; + for (AstNode* argp = nodep->pinsp(); argp; argp = argp->nextp()) { + ++narg; + UASSERT_OBJ(VN_IS(argp, Arg), nodep, "Method arg without Arg type"); + } bool ok = (narg >= minArg) && (narg <= maxArg); if (!ok) { nodep->v3error("The "<prettyName() @@ -3903,16 +3906,18 @@ private: //---------------------------------------------------------------------- // METHODS - data types - AstNodeDType* moveChildDTypeEdit(AstNode* nodep) { - // DTypes at parse time get added as a childDType to some node types such as AstVars. - // We move them to global scope, so removing/changing a variable won't lose the dtype. - AstNodeDType* dtnodep = nodep->getChildDTypep(); - UASSERT_OBJ(dtnodep, nodep, "Caller should check for NULL before calling moveChild"); - UINFO(9,"moveChildDTypeEdit "<unlinkFrBack(); // Make non-child v3Global.rootp()->typeTablep()->addTypesp(dtnodep); return dtnodep; } + AstNodeDType* moveChildDTypeEdit(AstNode* nodep) { + return moveDTypeEdit(nodep, nodep->getChildDTypep()); + } AstNodeDType* iterateEditDTypep(AstNode* parentp, AstNodeDType* nodep) { // Iterate into a data type to resolve that type. This process // may eventually create a new data type, but not today diff --git a/src/verilog.y b/src/verilog.y index eaa0588ce..68fc6208a 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -2732,6 +2732,7 @@ patternKey: // IEEE: merge structure_pattern_key, array_pattern_key, ass yaINTNUM { $$ = new AstConst($1,*$1); } | yaFLOATNUM { $$ = new AstConst($1,AstConst::RealDouble(),$1); } | yaID__ETC { $$ = new AstText($1,*$1); } + | strAsInt { $$ = $1; } ; assignment_pattern: // ==IEEE: assignment_pattern