pattern: Make parameter packs work inside later scopes

This commit is contained in:
WerWolv 2022-01-30 17:48:51 +01:00
parent 6a724352b0
commit 7321d205fe
1 changed files with 5 additions and 0 deletions

View File

@ -620,6 +620,7 @@ namespace hex::pl {
evaluator->handleAbort();
auto variables = *evaluator->getScope(0).scope;
auto parameterPack = evaluator->getScope(0).parameterPack;
u32 startVariableCount = variables.size();
ON_SCOPE_EXIT {
i64 stackSize = evaluator->getStack().size();
@ -632,6 +633,7 @@ namespace hex::pl {
};
evaluator->pushScope(nullptr, variables);
evaluator->getScope(0).parameterPack = parameterPack;
ON_SCOPE_EXIT { evaluator->popScope(); };
auto ctrlFlow = ControlFlowStatement::None;
@ -1914,6 +1916,8 @@ namespace hex::pl {
auto &body = evaluateCondition(evaluator) ? this->m_trueBody : this->m_falseBody;
auto variables = *evaluator->getScope(0).scope;
auto parameterPack = evaluator->getScope(0).parameterPack;
u32 startVariableCount = variables.size();
ON_SCOPE_EXIT {
i64 stackSize = evaluator->getStack().size();
@ -1926,6 +1930,7 @@ namespace hex::pl {
};
evaluator->pushScope(nullptr, variables);
evaluator->getScope(0).parameterPack = parameterPack;
ON_SCOPE_EXIT { evaluator->popScope(); };
for (auto &statement : body) {
auto result = statement->execute(evaluator);