| ... | @@ -1510,6 +1510,19 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c | ... | @@ -1510,6 +1510,19 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c |
| 1510 | } | 1510 | } |
| 1511 | } | 1511 | } |
| 1512 | | 1512 | |
| | 1513 | if (fn_proto->return_var_token != nullptr) { |
| | 1514 | if (!calling_convention_allows_zig_types(fn_type_id.cc)) { |
| | 1515 | add_node_error(g, fn_proto->return_type, |
| | 1516 | buf_sprintf("return type 'var' not allowed in function with calling convention '%s'", |
| | 1517 | calling_convention_name(fn_type_id.cc))); |
| | 1518 | return g->builtin_types.entry_invalid; |
| | 1519 | } |
| | 1520 | add_node_error(g, proto_node, |
| | 1521 | buf_sprintf("TODO implement inferred return types https://github.com/zig-lang/zig/issues/447")); |
| | 1522 | return g->builtin_types.entry_invalid; |
| | 1523 | //return get_generic_fn_type(g, &fn_type_id); |
| | 1524 | } |
| | 1525 | |
| 1513 | TypeTableEntry *specified_return_type = analyze_type_expr(g, child_scope, fn_proto->return_type); | 1526 | TypeTableEntry *specified_return_type = analyze_type_expr(g, child_scope, fn_proto->return_type); |
| 1514 | if (type_is_invalid(specified_return_type)) { | 1527 | if (type_is_invalid(specified_return_type)) { |
| 1515 | fn_type_id.return_type = g->builtin_types.entry_invalid; | 1528 | fn_type_id.return_type = g->builtin_types.entry_invalid; |
| ... | @@ -1523,16 +1536,6 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c | ... | @@ -1523,16 +1536,6 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c |
| 1523 | fn_type_id.return_type = specified_return_type; | 1536 | fn_type_id.return_type = specified_return_type; |
| 1524 | } | 1537 | } |
| 1525 | | 1538 | |
| 1526 | if (fn_proto->return_var_token != nullptr) { | | |
| 1527 | if (!calling_convention_allows_zig_types(fn_type_id.cc)) { | | |
| 1528 | add_node_error(g, fn_proto->return_type, | | |
| 1529 | buf_sprintf("return type 'var' not allowed in function with calling convention '%s'", | | |
| 1530 | calling_convention_name(fn_type_id.cc))); | | |
| 1531 | return g->builtin_types.entry_invalid; | | |
| 1532 | } | | |
| 1533 | return get_generic_fn_type(g, &fn_type_id); | | |
| 1534 | } | | |
| 1535 | | | |
| 1536 | if (!calling_convention_allows_zig_types(fn_type_id.cc) && !type_allowed_in_extern(g, fn_type_id.return_type)) { | 1539 | if (!calling_convention_allows_zig_types(fn_type_id.cc) && !type_allowed_in_extern(g, fn_type_id.return_type)) { |
| 1537 | add_node_error(g, fn_proto->return_type, | 1540 | add_node_error(g, fn_proto->return_type, |
| 1538 | buf_sprintf("return type '%s' not allowed in function with calling convention '%s'", | 1541 | buf_sprintf("return type '%s' not allowed in function with calling convention '%s'", |