| ... | ... | @@ -2864,9 +2864,14 @@ fn fnDecl( |
| 2864 | 2864 | _ = try expr(&fn_gz, params_scope, .none, body_node); |
| 2865 | 2865 | } |
| 2866 | 2866 | |
| 2867 | | if (fn_gz.instructions.items.len == 0 or |
| 2868 | | !astgen.instructions.items(.tag)[fn_gz.instructions.items.len - 1].isNoReturn()) |
| 2869 | | { |
| 2867 | const need_implicit_ret = blk: { |
| 2868 | if (fn_gz.instructions.items.len == 0) |
| 2869 | break :blk true; |
| 2870 | const last = fn_gz.instructions.items[fn_gz.instructions.items.len - 1]; |
| 2871 | const zir_tags = astgen.instructions.items(.tag); |
| 2872 | break :blk !zir_tags[last].isNoReturn(); |
| 2873 | }; |
| 2874 | if (need_implicit_ret) { |
| 2870 | 2875 | // Since we are adding the return instruction here, we must handle the coercion. |
| 2871 | 2876 | // We do this by using the `ret_coerce` instruction. |
| 2872 | 2877 | _ = try fn_gz.addUnTok(.ret_coerce, .void_value, tree.lastToken(body_node)); |