stage1 修复错误 提供类型检查
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user