feat: 命名参数 draw_rect(width: 10, height: 20)
This commit is contained in:
+3
-3
@@ -258,7 +258,7 @@ void test_codegen_enum() {
|
||||
AstNode* c_ident = ast_make_ident(&a, "c", loc_at(1, 1));
|
||||
c_ident->type.kind = TYPE_ENUM;
|
||||
AstNode* args[] = { c_ident };
|
||||
AstNode* print_call = ast_make_call(&a, "print_i64", args, 1, loc_at(1, 1));
|
||||
AstNode* print_call = ast_make_call(&a, "print_i64", args, NULL, 1, loc_at(1, 1));
|
||||
|
||||
/* return 0; */
|
||||
AstNode* ret = ast_make_return(&a, ast_make_literal_i64(&a, 0, loc_at(1, 1)), loc_at(1, 1));
|
||||
@@ -323,7 +323,7 @@ void test_codegen_array() {
|
||||
|
||||
// print_i64(arr[0]);
|
||||
AstNode* args[] = { idx_expr };
|
||||
AstNode* print_call = ast_make_call(&a, "print_i64", args, 1, loc_at(1, 1));
|
||||
AstNode* print_call = ast_make_call(&a, "print_i64", args, NULL, 1, loc_at(1, 1));
|
||||
|
||||
// return 0;
|
||||
AstNode* ret = ast_make_return(&a, ast_make_literal_i64(&a, 0, loc_at(1, 1)), loc_at(1, 1));
|
||||
@@ -393,7 +393,7 @@ void test_codegen_method_call() {
|
||||
AstNode* p_ident = ast_make_ident(&a, "p", loc_at(1, 1));
|
||||
p_ident->type.kind = TYPE_STRUCT;
|
||||
p_ident->type.struct_name = "Point";
|
||||
AstNode* method_call = ast_make_method_call(&a, p_ident, "get_x", NULL, 0, loc_at(1, 1));
|
||||
AstNode* method_call = ast_make_method_call(&a, p_ident, "get_x", NULL, NULL, 0, loc_at(1, 1));
|
||||
method_call->type.kind = TYPE_I64;
|
||||
|
||||
AstNode* ret_main = ast_make_return(&a, method_call, loc_at(1, 1));
|
||||
|
||||
Reference in New Issue
Block a user