| ... | ... | @@ -907,14 +907,18 @@ static TypeTableEntry *analyze_fn_proto_type(CodeGen *g, ImportTableEntry *impor |
| 907 | 907 | fn_type_id.param_info = allocate_nonzero<FnTypeParamInfo>(fn_type_id.param_count); |
| 908 | 908 | |
| 909 | 909 | fn_type_id.is_var_args = fn_proto->is_var_args; |
| 910 | | fn_type_id.return_type = analyze_type_expr(g, import, context, fn_proto->return_type); |
| 911 | 910 | |
| 912 | 911 | for (size_t i = 0; i < fn_type_id.param_count; i += 1) { |
| 913 | 912 | AstNode *child = fn_proto->params.at(i); |
| 914 | 913 | assert(child->type == NodeTypeParamDecl); |
| 915 | 914 | |
| 916 | | TypeTableEntry *type_entry = analyze_type_expr(g, import, context, |
| 917 | | child->data.param_decl.type); |
| 915 | TypeTableEntry *type_entry; |
| 916 | if (fn_proto->skip) { |
| 917 | type_entry = g->builtin_types.entry_invalid; |
| 918 | } else { |
| 919 | type_entry = analyze_type_expr(g, import, context, child->data.param_decl.type); |
| 920 | } |
| 921 | |
| 918 | 922 | switch (type_entry->id) { |
| 919 | 923 | case TypeTableEntryIdInvalid: |
| 920 | 924 | fn_proto->skip = true; |
| ... | ... | @@ -927,16 +931,20 @@ static TypeTableEntry *analyze_fn_proto_type(CodeGen *g, ImportTableEntry *impor |
| 927 | 931 | case TypeTableEntryIdNamespace: |
| 928 | 932 | case TypeTableEntryIdBlock: |
| 929 | 933 | case TypeTableEntryIdGenericFn: |
| 930 | | fn_proto->skip = true; |
| 931 | | add_node_error(g, child->data.param_decl.type, |
| 932 | | buf_sprintf("parameter of type '%s' not allowed", buf_ptr(&type_entry->name))); |
| 934 | if (!fn_proto->skip) { |
| 935 | fn_proto->skip = true; |
| 936 | add_node_error(g, child->data.param_decl.type, |
| 937 | buf_sprintf("parameter of type '%s' not allowed", buf_ptr(&type_entry->name))); |
| 938 | } |
| 933 | 939 | break; |
| 934 | 940 | case TypeTableEntryIdMetaType: |
| 935 | 941 | if (!child->data.param_decl.is_inline) { |
| 936 | | fn_proto->skip = true; |
| 937 | | add_node_error(g, child->data.param_decl.type, |
| 938 | | buf_sprintf("parameter of type '%s' must be declared inline", |
| 939 | | buf_ptr(&type_entry->name))); |
| 942 | if (!fn_proto->skip) { |
| 943 | fn_proto->skip = true; |
| 944 | add_node_error(g, child->data.param_decl.type, |
| 945 | buf_sprintf("parameter of type '%s' must be declared inline", |
| 946 | buf_ptr(&type_entry->name))); |
| 947 | } |
| 940 | 948 | } |
| 941 | 949 | break; |
| 942 | 950 | case TypeTableEntryIdVoid: |
| ... | ... | @@ -967,6 +975,11 @@ static TypeTableEntry *analyze_fn_proto_type(CodeGen *g, ImportTableEntry *impor |
| 967 | 975 | param_info->is_noalias = child->data.param_decl.is_noalias; |
| 968 | 976 | } |
| 969 | 977 | |
| 978 | if (fn_proto->skip) { |
| 979 | fn_type_id.return_type = g->builtin_types.entry_invalid; |
| 980 | } else { |
| 981 | fn_type_id.return_type = analyze_type_expr(g, import, context, fn_proto->return_type); |
| 982 | } |
| 970 | 983 | switch (fn_type_id.return_type->id) { |
| 971 | 984 | case TypeTableEntryIdInvalid: |
| 972 | 985 | fn_proto->skip = true; |
| ... | ... | @@ -979,9 +992,11 @@ static TypeTableEntry *analyze_fn_proto_type(CodeGen *g, ImportTableEntry *impor |
| 979 | 992 | case TypeTableEntryIdBlock: |
| 980 | 993 | case TypeTableEntryIdGenericFn: |
| 981 | 994 | case TypeTableEntryIdVar: |
| 982 | | fn_proto->skip = true; |
| 983 | | add_node_error(g, fn_proto->return_type, |
| 984 | | buf_sprintf("return type '%s' not allowed", buf_ptr(&fn_type_id.return_type->name))); |
| 995 | if (!fn_proto->skip) { |
| 996 | fn_proto->skip = true; |
| 997 | add_node_error(g, fn_proto->return_type, |
| 998 | buf_sprintf("return type '%s' not allowed", buf_ptr(&fn_type_id.return_type->name))); |
| 999 | } |
| 985 | 1000 | break; |
| 986 | 1001 | case TypeTableEntryIdMetaType: |
| 987 | 1002 | case TypeTableEntryIdUnreachable: |