stage1 修复错误 提供类型检查

This commit is contained in:
zzy
2026-07-25 22:48:35 +08:00
parent 02095524b1
commit 89d4bae8db
6 changed files with 219 additions and 17 deletions

View File

@@ -25,6 +25,10 @@ static int parse_params_decl(spl_comp_t *ctx, char pnames[][256], int ptypes[])
ctx->tok_idx = saved;
}
while (1) {
if (peek(ctx)->type == TOK_ELLIPSIS) {
advance(ctx);
break;
}
spl_tok_t *pname = advance(ctx);
spl_tok_copy_name(pname, pnames[nparams], 256);
skip_nl(ctx);
@@ -42,10 +46,6 @@ static int parse_params_decl(spl_comp_t *ctx, char pnames[][256], int ptypes[])
skip_nl(ctx);
continue;
}
if (peek(ctx)->type == TOK_ELLIPSIS) {
advance(ctx);
skip_nl(ctx);
}
break;
}
}
@@ -408,7 +408,6 @@ static void parse_type_body(spl_comp_t *ctx, int container_type_idx, int is_enum
}
ctx->tctx.current_type_idx = saved_current;
spl_type_compute_layout(&ctx->tctx, container_type_idx);
}
/* ============================================================
@@ -746,4 +745,9 @@ void spl_parse_prog(spl_comp_t *ctx) {
}
}
}
/* Recompute all type layouts now that forward references are resolved */
for (int i = 0; i < (int)vec_size(ctx->tctx.types); i++) {
spl_type_compute_layout(&ctx->tctx, i);
}
}