Commit cede5933 authored by Guillaume Charifi's avatar Guillaume Charifi

compiler/parser: Introduce parser_node_destroy_no_recurse().

parent 140e5b44
......@@ -162,11 +162,8 @@ struct bm_ast_node *parser_node_exchange_with_child(struct bm_ast_node *node, un
return parser_node_get_child(node, child_sub_node_id);
}
int parser_node_destroy(struct bm_ast_node *node)
static int parser_node_destroy_no_recurse(struct bm_ast_node *node)
{
for (unsigned long i = 0; i < node->children_count; i++)
parser_node_destroy(&node->children[i]);
if (node->children)
free(node->children);
node->children = NULL;
......@@ -179,6 +176,14 @@ int parser_node_destroy(struct bm_ast_node *node)
return 0;
}
int parser_node_destroy(struct bm_ast_node *node)
{
for (unsigned long i = 0; i < node->children_count; i++)
parser_node_destroy(&node->children[i]);
return parser_node_destroy_no_recurse(node);
}
int parser_ignore_newlines_or_semicolons(struct parser_ctx *ctx, unsigned long *cur_tok_id)
{
unsigned long i = *cur_tok_id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment