| ... | @@ -3798,7 +3798,7 @@ fn analyzeFancyFunction( | ... | @@ -3798,7 +3798,7 @@ fn analyzeFancyFunction( |
| 3798 | file, | 3798 | file, |
| 3799 | scope, | 3799 | scope, |
| 3800 | parent_src, | 3800 | parent_src, |
| 3801 | fn_info.body[fn_info.body.len - 1], | 3801 | fn_info.body[0], |
| 3802 | ); | 3802 | ); |
| 3803 | } else { | 3803 | } else { |
| 3804 | break :blk null; | 3804 | break :blk null; |
| ... | @@ -3936,7 +3936,7 @@ fn analyzeFunction( | ... | @@ -3936,7 +3936,7 @@ fn analyzeFunction( |
| 3936 | file, | 3936 | file, |
| 3937 | scope, | 3937 | scope, |
| 3938 | parent_src, | 3938 | parent_src, |
| 3939 | fn_info.body[fn_info.body.len - 1], | 3939 | fn_info.body[0], |
| 3940 | ); | 3940 | ); |
| 3941 | } else { | 3941 | } else { |
| 3942 | break :blk null; | 3942 | break :blk null; |
| ... | @@ -3977,11 +3977,25 @@ fn getGenericReturnType( | ... | @@ -3977,11 +3977,25 @@ fn getGenericReturnType( |
| 3977 | file: *File, | 3977 | file: *File, |
| 3978 | scope: *Scope, | 3978 | scope: *Scope, |
| 3979 | parent_src: SrcLocInfo, // function decl line | 3979 | parent_src: SrcLocInfo, // function decl line |
| 3980 | body_end: usize, | 3980 | body_main_block: usize, |
| 3981 | ) !DocData.Expr { | 3981 | ) !DocData.Expr { |
| 3982 | // TODO: compute the correct line offset | 3982 | const tags = file.zir.instructions.items(.tag); |
| 3983 | const wr = try self.walkInstruction(file, scope, parent_src, body_end - 3, false); | 3983 | const data = file.zir.instructions.items(.data); |
| 3984 | return wr.expr; | 3984 | |
| | 3985 | // We expect `body_main_block` to be the first instruction |
| | 3986 | // inside the function body, and for it to be a block instruction. |
| | 3987 | const pl_node = data[body_main_block].pl_node; |
| | 3988 | const extra = file.zir.extraData(Zir.Inst.Block, pl_node.payload_index); |
| | 3989 | const maybe_ret_node = file.zir.extra[extra.end..][extra.data.body_len - 4]; |
| | 3990 | switch (tags[maybe_ret_node]) { |
| | 3991 | .ret_node, .ret_load => { |
| | 3992 | const wr = try self.walkInstruction(file, scope, parent_src, maybe_ret_node, false); |
| | 3993 | return wr.expr; |
| | 3994 | }, |
| | 3995 | else => { |
| | 3996 | return DocData.Expr{ .comptimeExpr = 0 }; |
| | 3997 | }, |
| | 3998 | } |
| 3985 | } | 3999 | } |
| 3986 | | 4000 | |
| 3987 | fn collectUnionFieldInfo( | 4001 | fn collectUnionFieldInfo( |