Skip to content

Commit fa9c9d3

Browse files
committed
revert setting current_struct_elem
1 parent 4a05db9 commit fa9c9d3

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

systemverilog-plugin/UhdmAst.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -746,19 +746,15 @@ void UhdmAst::uhdmast_assert_log(const char *expr_str, const char *func, const c
746746

747747
static AST::AstNode *expand_dot(const AST::AstNode *current_struct, const AST::AstNode *search_node)
748748
{
749-
const AST::AstNode *current_struct_elem;
749+
AST::AstNode *current_struct_elem = nullptr;
750750
auto search_str = search_node->str.find("\\") == 0 ? search_node->str.substr(1) : search_node->str;
751751
auto struct_elem_it =
752752
std::find_if(current_struct->children.begin(), current_struct->children.end(), [&](AST::AstNode *node) { return node->str == search_str; });
753-
if (struct_elem_it == current_struct->children.end() && current_struct->str == search_str) {
754-
// Couldn't find the elem, but the search string matches the current struct.
755-
current_struct_elem = current_struct;
756-
} else if (struct_elem_it == current_struct->children.end()) {
753+
if (struct_elem_it == current_struct->children.end()) {
757754
current_struct->dumpAst(NULL, "struct >");
758755
log_error("Couldn't find search elem: %s in struct\n", search_str.c_str());
759-
} else {
760-
current_struct_elem = *struct_elem_it;
761756
}
757+
current_struct_elem = *struct_elem_it;
762758

763759
AST::AstNode *sub_dot = nullptr;
764760
std::vector<AST::AstNode *> struct_ranges;

0 commit comments

Comments
 (0)