stage1 修复bug 删除递归测试
This commit is contained in:
@@ -97,7 +97,8 @@ static void parse_var_decl(spl_comp_t *ctx, int is_const) {
|
||||
/* Store init value */
|
||||
if (has_init) {
|
||||
/* Handle slice struct literal: { .ptr = ..., .len = ... } */
|
||||
if (var_type && var_type->kind == TYPE_SLICE && peek(ctx)->type == TOK_L_BRACE && !init.type) {
|
||||
if (var_type && var_type->kind == TYPE_SLICE && peek(ctx)->type == TOK_L_BRACE &&
|
||||
!init.type) {
|
||||
advance(ctx); /* { */
|
||||
skip_nl(ctx);
|
||||
while (peek(ctx)->type != TOK_R_BRACE && peek(ctx)->type != TOK_EOF) {
|
||||
@@ -144,18 +145,7 @@ static void parse_var_decl(spl_comp_t *ctx, int is_const) {
|
||||
} else {
|
||||
/* Multi-slot: copy from temp addr to var, slot by slot */
|
||||
usize nslots = (sz + sizeof(spl_val_t) - 1) / sizeof(spl_val_t);
|
||||
for (usize i = 0; i < nslots; i++) {
|
||||
if (i < nslots - 1)
|
||||
spl_emit(ctx, SPL_DUP, SPL_VOID, 0);
|
||||
if (i > 0) {
|
||||
spl_emit(ctx, SPL_PUSH, SPL_USIZE, i * sizeof(spl_val_t));
|
||||
spl_emit(ctx, SPL_ADD, SPL_USIZE, 0);
|
||||
}
|
||||
spl_emit(ctx, SPL_LOAD, SPL_PTR, 0);
|
||||
spl_emit(ctx, SPL_LADDR, SPL_PTR, offset + (int)(i * sizeof(spl_val_t)));
|
||||
spl_emit(ctx, SPL_SWAP, SPL_VOID, 0);
|
||||
spl_emit(ctx, SPL_STORE, SPL_PTR, 0);
|
||||
}
|
||||
spl_emit_copy_slots(ctx, offset, nslots);
|
||||
}
|
||||
} else if (var_type && var_type->kind == TYPE_ARRAY) {
|
||||
/* Array initialization: store each element in reverse stack order */
|
||||
|
||||
Reference in New Issue
Block a user