ast: implement cleanup callbacks
This commit is contained in:
@@ -154,10 +154,8 @@ struct bshell_ast_node *bshell_ast_iterator_dequeue(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct bshell_ast_node *node = fx_unbox(
|
||||
struct bshell_ast_node,
|
||||
cur,
|
||||
n_it.e_entry);
|
||||
struct bshell_ast_node *node
|
||||
= fx_unbox(struct bshell_ast_node, cur, n_it.e_entry);
|
||||
const struct bshell_ast_node_definition *def
|
||||
= bshell_ast_node_definitions[node->n_type];
|
||||
|
||||
@@ -178,10 +176,8 @@ void bshell_ast_iterator_enqueue(
|
||||
|
||||
fx_queue_entry *cur = fx_queue_first(&it->it_queue);
|
||||
if (cur) {
|
||||
struct bshell_ast_node *cur_node = fx_unbox(
|
||||
struct bshell_ast_node,
|
||||
cur,
|
||||
n_it.e_entry);
|
||||
struct bshell_ast_node *cur_node
|
||||
= fx_unbox(struct bshell_ast_node, cur, n_it.e_entry);
|
||||
new_depth = cur_node->n_it.e_depth + 1;
|
||||
}
|
||||
|
||||
@@ -222,11 +218,8 @@ enum bshell_status bshell_ast_node_iterate(
|
||||
return BSHELL_ERR_INTERNAL_FAILURE;
|
||||
}
|
||||
|
||||
struct bshell_ast_iterate_result result = callback(
|
||||
node,
|
||||
BSHELL_AST_ITERATION_PRE,
|
||||
it,
|
||||
arg);
|
||||
struct bshell_ast_iterate_result result
|
||||
= callback(node, BSHELL_AST_ITERATION_PRE, it, arg);
|
||||
if (result.r_status != BSHELL_SUCCESS
|
||||
|| result.r_flags & BSHELL_AST_ITERATE_STOP) {
|
||||
return result.r_status;
|
||||
@@ -258,11 +251,8 @@ enum bshell_status bshell_ast_node_iterate(
|
||||
return BSHELL_ERR_INTERNAL_FAILURE;
|
||||
}
|
||||
|
||||
struct bshell_ast_iterate_result result = callback(
|
||||
node,
|
||||
BSHELL_AST_ITERATION_POST,
|
||||
it,
|
||||
arg);
|
||||
struct bshell_ast_iterate_result result
|
||||
= callback(node, BSHELL_AST_ITERATION_POST, it, arg);
|
||||
if (result.r_status != BSHELL_SUCCESS
|
||||
|| result.r_flags & BSHELL_AST_ITERATE_STOP) {
|
||||
return result.r_status;
|
||||
|
||||
Reference in New Issue
Block a user