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