First delete the blocks, THEN the locals, since blocks USE locals, darn

This commit is contained in:
Wolfgang Bumiller 2012-04-28 17:29:43 +02:00
parent 6145ecf7e0
commit eef92df092

6
ast.c
View file

@ -169,12 +169,12 @@ MEM_VEC_FUNCTIONS(ast_block, ast_expression*, exprs)
void ast_block_delete(ast_block *self)
{
size_t i;
for (i = 0; i < self->locals_count; ++i)
ast_delete(self->locals[i]);
MEM_VECTOR_CLEAR(self, locals);
for (i = 0; i < self->exprs_count; ++i)
ast_unref(self->exprs[i]);
MEM_VECTOR_CLEAR(self, exprs);
for (i = 0; i < self->locals_count; ++i)
ast_delete(self->locals[i]);
MEM_VECTOR_CLEAR(self, locals);
mem_d(self);
}