stage1 继续重构sema 提供更多dbg宏用于日志记录

This commit is contained in:
zzy
2026-08-19 21:37:40 +08:00
parent 994a35a942
commit b2e6ade484
7 changed files with 386 additions and 75 deletions

View File

@@ -409,7 +409,7 @@ static spl_ast_node_ref_t parse_type_decl(parser_t *p, spl_ast_node_ref_vec_t at
if (t && (t->type == TOK_COMMA || t->type == TOK_SEMICOLON)) {
advance(p);
} else {
LOG_WARN("need comma or semicolon with member decl");
SPL_WARN(t, "need comma or semicolon with member decl");
}
return ref;
}
@@ -434,7 +434,7 @@ static spl_ast_node_ref_t parse_member_decl(parser_t *p, spl_ast_node_ref_vec_t
if (t && (t->type == TOK_COMMA || t->type == TOK_SEMICOLON)) {
advance(p);
} else {
LOG_WARN("need comma or semicolon with member decl");
SPL_WARN(t, "need comma or semicolon with member decl");
}
return ref;
}
@@ -484,7 +484,7 @@ static spl_ast_node_ref_t parse_var_const_decl(parser_t *p, spl_ast_node_ref_vec
if (t && t->type == TOK_SEMICOLON) {
advance(p);
} else {
LOG_WARN("need semicolon in decl var/const");
SPL_WARN(t, "need semicolon in decl var/const");
}
return ref;
}
@@ -1867,8 +1867,10 @@ static void dump_node(spl_ast_t *ast, spl_ast_node_ref_t node_ref, dump_stack_t
case SPL_AST_FN_DEFINE:
dump_vec(ast, node->fn_decl.attr_list, stack);
dump_vec(ast, node->fn_decl.param_list, stack);
if (node->fn_decl.type_expr)
dump_node(ast, node->fn_decl.type_expr, stack, 1);
if (node->fn_decl.type_expr) {
last = node->kind == SPL_AST_FN_DECL ? 1 : 0;
dump_node(ast, node->fn_decl.type_expr, stack, last);
}
dump_vec(ast, node->fn_decl.block, stack);
break;