From 4e425289bbf09e3f76c61e1257f58b40935a57f8 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 15 Aug 2026 21:00:12 -0700 Subject: [PATCH] symbol_search(): Track object visibility directly The scope traversal tracks whether it has crossed a module boundary and uses the inverse of that state to decide whether objects are visible. Track object visibility directly instead. This keeps the existing behavior while making the module-boundary rule and later traversal changes easier to follow. Signed-off-by: Lars-Peter Clausen --- symbol_search.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/symbol_search.cc b/symbol_search.cc index 9032411cf..e5bc034f8 100644 --- a/symbol_search.cc +++ b/symbol_search.cc @@ -388,7 +388,7 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope, } } - bool passed_module_boundary = false; + bool search_objects = true; // At this point, we've stripped right-most components until the search // found the scope part of the path, or there is no scope part of the @@ -427,7 +427,7 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope, // ... not_ok; // <-- Should NOT match. // ... top.not_ok; // Matches. // endmodule - if (!passed_module_boundary) { + if (search_objects) { scope_object_search_result_t object_result = symbol_search_scope_objects( li, des, scope, start_scope, path, path_tail, @@ -479,10 +479,10 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope, // If there is no prefix, then we are free to scan upwards looking // for a scope name. Note that only scopes can be searched for up - // past module boundaries. To handle that, set a flag to indicate - // that we passed a module boundary on the way up. + // past module boundaries. Stop searching for objects after leaving + // the module, but continue searching for matching scope names. if (scope->type()==NetScope::MODULE && !scope->nested_module()) - passed_module_boundary = true; + search_objects = false; scope = scope->parent(); @@ -503,7 +503,7 @@ bool symbol_search(const LineInfo*li, Design*des, NetScope*scope, if (scope == 0 && start_scope != 0) { scope = start_scope->unit(); start_scope = 0; - passed_module_boundary = false; + search_objects = true; } }