Clear pkg_user_types if no packages following a 'design -reset-vlog'.
authorPeter <peter@crozier.com>
Tue, 3 Mar 2020 19:30:54 +0000 (19:30 +0000)
committerGrazfather <grazfather@gmail.com>
Mon, 23 Mar 2020 01:20:46 +0000 (18:20 -0700)
frontends/verilog/verilog_frontend.cc
frontends/verilog/verilog_parser.y

index de05d29a7b9c6e6c768d66215203cd770da2ad98..61db0a176edea403e1ee1a2f098fadd2ab729584 100644 (file)
@@ -465,6 +465,10 @@ struct VerilogFrontend : public Frontend {
                                log("-- Verilog code after preprocessor --\n%s-- END OF DUMP --\n", code_after_preproc.c_str());
                        lexin = new std::istringstream(code_after_preproc);
                }
+               if (design->verilog_packages.empty()) {
+                       // might be because of a `design -reset-vlog` command
+                       pkg_user_types.clear();
+               }
 
                frontend_verilog_yyset_lineno(1);
                frontend_verilog_yyrestart(NULL);
index 690dfdb6e5138bf2472e86a1ab723adea320d71a..f7e3afd13ff3804687f22cd606d74bac990b9ea4 100644 (file)
@@ -522,6 +522,7 @@ interface:
                ast_stack.pop_back();
                log_assert(ast_stack.size() == 1);
                current_ast_mod = NULL;
+               user_types.clear();
        };
 
 interface_body: