feat: if let 语句 — if let Option::Some = expr { ... }

This commit is contained in:
2026-06-06 15:20:34 +08:00
parent 0e1f8c5795
commit e02cc7b1d6
4 changed files with 98 additions and 39 deletions
+9
View File
@@ -813,6 +813,15 @@ LLVMModuleRef codegen_module(AstNode* ast, Arena* codegen_arena,
memcpy_args, 3, false);
ctx.memcpy_fn = LLVMAddFunction(ctx.module, "memcpy", memcpy_ty);
// __chkstk 桩:LLVM 在生成大栈帧代码时会引用此符号(MinGW x64: __chkstk
{
LLVMTypeRef chkstk_ty = LLVMFunctionType(LLVMVoidTypeInContext(ctx.context), NULL, 0, false);
LLVMValueRef chkstk_fn = LLVMAddFunction(ctx.module, "__chkstk", chkstk_ty);
LLVMBasicBlockRef chk_bb = LLVMAppendBasicBlockInContext(ctx.context, chkstk_fn, "entry");
LLVMPositionBuilderAtEnd(ctx.builder, chk_bb);
LLVMBuildRetVoid(ctx.builder);
}
// 第零遍:先创建所有命名结构体(占位符,未设置 body)
for (size_t i = 0; i < ast->as.program.struct_count; i++) {
AstNode* sd = ast->as.program.structs[i];