stage0 重命名 stage1 ast重新整理

This commit is contained in:
zzy
2026-08-16 10:51:45 +08:00
parent 78d767bf21
commit d3c63dab5c
6 changed files with 27 additions and 21 deletions

View File

@@ -1792,8 +1792,8 @@ void spl_ast_prase(spl_ast_t *ast) {
if (d)
vec_push(members, d);
}
spl_ast_node_ref_t root = new_node(&p, SPL_AST_CONTAINER_ITEM, begin);
node_at(ast, root)->container_item.members = members;
spl_ast_node_ref_t root = new_node(&p, SPL_AST_CONTAINER_MEMBERS, begin);
node_at(ast, root)->container_members = members;
ast->root = root;
ast->parsed = p.failed ? -1 : 1;
}
@@ -1809,6 +1809,12 @@ void spl_ast_drop(spl_ast_t *ast) {
ast->root = 0;
}
spl_ast_node_t *spl_ast_node(spl_ast_t *ast, spl_ast_node_ref_t node) {
if (!ast || node == 0)
return NULL;
return &vec_at(ast->node_buckets, node);
}
void spl_ast_valid(spl_ast_t *ast) {
if (!ast)
return;
@@ -1851,9 +1857,8 @@ static void dump_node(spl_ast_t *ast, spl_ast_node_ref_t node_ref, dump_stack_t
UNREACHABLE();
break;
case SPL_AST_CONTAINER_ITEM:
dump_vec(ast, node->container_item.attr_list, stack);
dump_vec(ast, node->container_item.members, stack);
case SPL_AST_CONTAINER_MEMBERS:
dump_vec(ast, node->container_members, stack);
break;
case SPL_AST_FN_DECL: