patterns: Fixed multi-variable decl crash

This commit is contained in:
WerWolv 2021-10-05 22:08:05 +02:00
parent e3a6ac548b
commit 7eb4b40dc7
1 changed files with 2 additions and 1 deletions

View File

@ -715,8 +715,9 @@ namespace hex::pl {
auto variableCleanup = SCOPE_GUARD { for (auto var : variables) delete var; }; auto variableCleanup = SCOPE_GUARD { for (auto var : variables) delete var; };
do { do {
variables.push_back(create(new ASTNodeVariableDecl(getValue<Token::Identifier>(-1).get(), type))); variables.push_back(create(new ASTNodeVariableDecl(getValue<Token::Identifier>(-1).get(), type->clone())));
} while (MATCHES(sequence(SEPARATOR_COMMA, IDENTIFIER))); } while (MATCHES(sequence(SEPARATOR_COMMA, IDENTIFIER)));
delete type;
variableCleanup.release(); variableCleanup.release();