feat: 多返回值 fn f(...) -> (T, U) { return (e1, e2); }

Parser: -> (T1,T2) 解析为隐式 struct __ret_funcname, return (e1,e2) 去糖为 struct init
返回的 struct 可访问字段 _0, _1, ... 无 sema/codegen 改动

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 14:07:13 +08:00
parent 06c8773fac
commit 71208a87f4
4 changed files with 114 additions and 9 deletions
+2 -1
View File
@@ -71,7 +71,8 @@ struct AstNode {
struct { const char* name; struct AstNode** params; size_t param_count;
TypeKind return_type; const char* return_struct_type_name;
struct AstNode* body; bool is_pub;
const char** type_params; size_t type_param_count; } function;
const char** type_params; size_t type_param_count;
TypeKind* multi_ret_types; const char** multi_ret_snames; size_t multi_ret_count; } function;
// AST_PARAMETER (也用作结构体字段: name + type)
struct { const char* name; TypeKind type; const char* struct_type_name; } parameter;
// AST_BLOCK