diff --git a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp index cb3cf2d7c..67b273941 100644 --- a/plugins/libimhex/include/hex/pattern_language/ast_node.hpp +++ b/plugins/libimhex/include/hex/pattern_language/ast_node.hpp @@ -1717,15 +1717,21 @@ namespace hex::pl { currPattern = newPattern; } - if (auto structPattern = dynamic_cast(currPattern)) + PatternData *indexPattern; + if (currPattern->isLocal()) + indexPattern = std::get(evaluator->getStack()[currPattern->getOffset()]); + else + indexPattern = currPattern; + + if (auto structPattern = dynamic_cast(indexPattern)) searchScope = structPattern->getMembers(); - else if (auto unionPattern = dynamic_cast(currPattern)) + else if (auto unionPattern = dynamic_cast(indexPattern)) searchScope = unionPattern->getMembers(); - else if (auto bitfieldPattern = dynamic_cast(currPattern)) + else if (auto bitfieldPattern = dynamic_cast(indexPattern)) searchScope = bitfieldPattern->getFields(); - else if (auto dynamicArrayPattern = dynamic_cast(currPattern)) + else if (auto dynamicArrayPattern = dynamic_cast(indexPattern)) searchScope = dynamicArrayPattern->getEntries(); - else if (auto staticArrayPattern = dynamic_cast(currPattern)) + else if (auto staticArrayPattern = dynamic_cast(indexPattern)) searchScope = { staticArrayPattern->getTemplate() }; }