fix(argparse): 修复参数解析错误处理逻辑
当解析过程中出现错误时,应该继续循环而不是直接跳出, 确保完整的错误处理流程能够执行。 fix(ast2ir): 修复函数调用表达式中的类型检查 在每次迭代中重新获取指针以避免向量重分配问题, 并添加类型引用断言确保参数类型有效性。 fix(lexer): 添加词法分析器资源释放 在main函数中正确释放tok_ring资源,防止内存泄漏。 test: 更新测试用例输出字符串格式 将测试用例中的输出字符串从全小写更新为首字母大写, 保持代码风格一致性。
This commit is contained in:
@@ -884,10 +884,11 @@ scc_hir_value_ref_t scc_ast2ir_expr(scc_ast2ir_ctx_t *ctx,
|
||||
arg_node = scc_ast2ir_expr(ctx, arg_expr, false);
|
||||
if ((int)i < fixed_count) {
|
||||
// 固定参数:转换为形参类型
|
||||
// 每次迭代重新获取指针(scc_ast2ir_expr 可能触发 types 向量 realloc)
|
||||
// 每次迭代重新获取指针(scc_ast2ir_expr 可能触发 types 向量
|
||||
// realloc)
|
||||
scc_hir_module_t *module = scc_ast2ir_mir_module(ctx);
|
||||
const scc_hir_type_t *ft = scc_hir_module_get_type(
|
||||
module, func_type_ref);
|
||||
const scc_hir_type_t *ft =
|
||||
scc_hir_module_get_type(module, func_type_ref);
|
||||
scc_hir_type_ref_t param_type =
|
||||
scc_vec_at(ft->data.function.params, i);
|
||||
arg_node =
|
||||
@@ -898,6 +899,7 @@ scc_hir_value_ref_t scc_ast2ir_expr(scc_ast2ir_ctx_t *ctx,
|
||||
scc_hir_module_t *module = scc_ast2ir_mir_module(ctx);
|
||||
scc_hir_type_ref_t arg_type_ref =
|
||||
scc_hir_module_get_value(module, arg_node)->type;
|
||||
Assert(arg_type_ref != 0);
|
||||
scc_hir_type_tag_t arg_tag =
|
||||
scc_hir_module_get_type(module, arg_type_ref)->tag;
|
||||
scc_hir_type_ref_t promoted =
|
||||
|
||||
Reference in New Issue
Block a user