Fix all valgrind leak issues in tests
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: Deukhoofd <deukhoofd@gmail.com>
This commit is contained in:
@@ -111,6 +111,10 @@ namespace Porygon::Parser {
|
||||
delete _expression;
|
||||
}
|
||||
|
||||
void NullifyExpression(){
|
||||
_expression = nullptr;
|
||||
}
|
||||
|
||||
const ParsedStatementKind GetKind() const final {
|
||||
return ParsedStatementKind::Expression;
|
||||
}
|
||||
|
||||
@@ -525,7 +525,10 @@ namespace Porygon::Parser {
|
||||
// If the first item is an expression, and is followed by a comma, we're dealing with a simple {1, 2, 3} kind of array
|
||||
if (firstItem->GetKind() == ParsedStatementKind::Expression &&
|
||||
(this->Peek()->GetKind() == TokenKind::CommaToken)) {
|
||||
auto expr = ((ParsedExpressionStatement *) firstItem)->GetExpression();
|
||||
auto statement = ((ParsedExpressionStatement *) firstItem);
|
||||
auto expr = statement->GetExpression();
|
||||
statement->NullifyExpression();
|
||||
delete statement;
|
||||
auto expressions = vector<const ParsedExpression *>{expr};
|
||||
auto n = this->Next(); // consume the comma
|
||||
bool hasErrors = false;
|
||||
|
||||
Reference in New Issue
Block a user