pattern: Fix scopes not always getting popped again correctly (#440)

Co-authored-by: Dmitry Polshakov <dmitry.polshakov@dsr-corporation.com>
This commit is contained in:
Polshakov Dmitry
2022-02-14 22:44:43 +03:00
committed by GitHub
parent 8be39488ec
commit 038b7961db
2 changed files with 21 additions and 8 deletions

View File

@@ -156,6 +156,9 @@ namespace hex::pl {
try {
this->setCurrentControlFlowStatement(ControlFlowStatement::None);
pushScope(nullptr, patterns);
ON_SCOPE_EXIT {
popScope();
};
for (auto node : ast) {
if (dynamic_cast<ASTNodeTypeDecl *>(node)) {
@@ -195,8 +198,6 @@ namespace hex::pl {
this->m_mainResult = mainFunction.func(this, {});
}
popScope();
} catch (PatternLanguageError &error) {
this->m_console.log(LogConsole::Level::Error, error.what());