diff --git a/netmisc.h b/netmisc.h index 6d7ce1315..d6f7ad94b 100644 --- a/netmisc.h +++ b/netmisc.h @@ -107,7 +107,7 @@ static inline bool test_function_return_value(const symbol_search_results&search extern bool symbol_search(const LineInfo*li, Design*des, NetScope*scope, pform_name_t path, struct symbol_search_results*res, - NetScope*start_scope = 0); + NetScope*start_scope = nullptr, bool prefix_scope = false); extern bool symbol_search(const LineInfo *li, Design *des, NetScope *scope, const pform_scoped_name_t &path, diff --git a/symbol_search.cc b/symbol_search.cc index ba471d301..013783720 100644 --- a/symbol_search.cc +++ b/symbol_search.cc @@ -39,10 +39,9 @@ using namespace std; bool symbol_search(const LineInfo*li, Design*des, NetScope*scope, pform_name_t path, struct symbol_search_results*res, - NetScope*start_scope) + NetScope*start_scope, bool prefix_scope) { assert(scope); - bool prefix_scope = false; if (debug_elaborate) { cerr << li->get_fileline() << ": symbol_search: " @@ -69,7 +68,8 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope, // recursively. Ideally, the result is a scope that we search // for the tail key, but there are other special cases as well. if (! path.empty()) { - bool flag = symbol_search(li, des, scope, path, res, start_scope); + bool flag = symbol_search(li, des, scope, path, res, start_scope, + prefix_scope); if (! flag) return false; @@ -314,14 +314,17 @@ bool symbol_search(const LineInfo *li, Design *des, NetScope *scope, struct symbol_search_results *res) { NetScope *search_scope = scope; + bool prefix_scope = false; if (path.package) { search_scope = des->find_package(path.package->pscope_name()); if (!search_scope) return false; + prefix_scope = true; } - return symbol_search(li, des, search_scope, path.name, res, nullptr); + return symbol_search(li, des, search_scope, path.name, res, search_scope, + prefix_scope); } /*