Skip to content

Commit 56f957c

Browse files
authored
Merge pull request #525 from antmicro/wsip/revert_expand_dot
revert setting current_struct_elem in expand_dot
2 parents 07edf81 + fa9c9d3 commit 56f957c

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
@@ -804,19 +804,15 @@ void UhdmAst::uhdmast_assert_log(const char *expr_str, const char *func, const c
804804

805805
static AST::AstNode *expand_dot(const AST::AstNode *current_struct, const AST::AstNode *search_node)
806806
{
807-
const AST::AstNode *current_struct_elem;
807+
AST::AstNode *current_struct_elem = nullptr;
808808
auto search_str = search_node->str.find("\\") == 0 ? search_node->str.substr(1) : search_node->str;
809809
auto struct_elem_it =
810810
std::find_if(current_struct->children.begin(), current_struct->children.end(), [&](AST::AstNode *node) { return node->str == search_str; });
811-
if (struct_elem_it == current_struct->children.end() && current_struct->str == search_str) {
812-
// Couldn't find the elem, but the search string matches the current struct.
813-
current_struct_elem = current_struct;
814-
} else if (struct_elem_it == current_struct->children.end()) {
811+
if (struct_elem_it == current_struct->children.end()) {
815812
current_struct->dumpAst(NULL, "struct >");
816813
log_error("Couldn't find search elem: %s in struct\n", search_str.c_str());
817-
} else {
818-
current_struct_elem = *struct_elem_it;
819814
}
815+
current_struct_elem = *struct_elem_it;
820816

821817
AST::AstNode *sub_dot = nullptr;
822818
std::vector<AST::AstNode *> struct_ranges;

0 commit comments

Comments
 (0)