diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-03-01 01:20:50 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-03-01 01:20:50 +0000 |
| commit | 408a08708fbb0abe03bfeaa835666a72d79c843d (patch) | |
| tree | a941fdcce6d66322f7b5d527d5044171cabf5f6c /src | |
| parent | 321045cf33268e7b75e2972d898010ecacc345dc (diff) | |
| download | zig-408a08708fbb0abe03bfeaa835666a72d79c843d.tar.gz zig-408a08708fbb0abe03bfeaa835666a72d79c843d.zip | |
Autodoc: do not rely on redundant block within function body
Diffstat (limited to 'src')
| -rw-r--r-- | src/Autodoc.zig | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/Autodoc.zig b/src/Autodoc.zig index f321fadbb7..480651fb20 100644 --- a/src/Autodoc.zig +++ b/src/Autodoc.zig @@ -5137,7 +5137,7 @@ fn analyzeFancyFunction( file, scope, parent_src, - fn_info.body[0], + fn_info.body, call_ctx, ); } else { @@ -5303,7 +5303,7 @@ fn analyzeFunction( file, scope, parent_src, - fn_info.body[0], + fn_info.body, call_ctx, ); } else { @@ -5350,17 +5350,10 @@ fn getGenericReturnType( file: *File, scope: *Scope, parent_src: SrcLocInfo, // function decl line - body_main_block: Zir.Inst.Index, + body: []const Zir.Inst.Index, call_ctx: ?*const CallContext, ) !DocData.Expr { const tags = file.zir.instructions.items(.tag); - const data = file.zir.instructions.items(.data); - - // We expect `body_main_block` to be the first instruction - // inside the function body, and for it to be a block instruction. - const pl_node = data[@intFromEnum(body_main_block)].pl_node; - const extra = file.zir.extraData(Zir.Inst.Block, pl_node.payload_index); - const body = file.zir.bodySlice(extra.end, extra.data.body_len); if (body.len >= 4) { const maybe_ret_inst = body[body.len - 4]; switch (tags[@intFromEnum(maybe_ret_inst)]) { |
