fix: P1审查修复 — error.c arena化 + Self类型解析 + trait查找加固 + 缓冲区安全

P1-①: error_init/add 从 malloc/realloc/strdup 改为 arena_alloc/arena_strdup
P1-②: impl 方法中 Self 类型在 sema 解析为实际结构体名
P1-③: trait 方法 fallback 增加前缀校验(strncmp),method_name 统一更新
P1-④: codegen args[16] 增加溢出检查,移除 parser 未使用的 mods/uses 数组
新增: 36_self_type.l 集成测试(Self 类型 + trait 方法)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-06 17:09:28 +08:00
parent 17c19fd9b9
commit 466be76fd8
9 changed files with 99 additions and 56 deletions
+1 -1
View File
@@ -491,7 +491,7 @@ void test_codegen_match() {
AstNode* fns[] = { main_fn };
AstNode* prog = ast_make_program(&a, fns, 1, NULL, 0, NULL, 0, enums, 1, NULL, 0, loc_at(1, 1));
ErrorList errors; error_init(&errors);
ErrorList errors; error_init(&errors, &a);
sema_analyze(prog, &errors, &a);
ASSERT(errors.count == 0);