| author | |
| committer | |
| log | ab2c602f3493d76e1ad6872cb578115b45b7c6fe |
| tree | 7249d0c87f7862fcc9896af0d1897bad39da46a1 |
| parent | 23cf44c227678bde07b872e2a5ff1089c028c582 |
| parent | 27d2848e0096d31cb42cb258a89ed276ec26434e |
| signature |
autodoc: Add struct to tryResolveRefPath2 files changed, 22 insertions(+), 3 deletions(-)
lib/docs/main.js+3-3| ... | @@ -1139,9 +1139,9 @@ const NAV_MODES = { | ... | @@ -1139,9 +1139,9 @@ const NAV_MODES = { |
| 1139 | return exprName(switchIndex, opts); | 1139 | return exprName(switchIndex, opts); |
| 1140 | } | 1140 | } |
| 1141 | case "fieldRef": { | 1141 | case "fieldRef": { |
| 1142 | const enumObj = exprName({ type: expr.fieldRef.type }, opts); | 1142 | const field_idx = expr.fieldRef.index; |
| 1143 | const field = | 1143 | const type = getType(expr.fieldRef.type); |
| 1144 | getAstNode(enumObj.src).fields[expr.fieldRef.index]; | 1144 | const field = getAstNode(type.src).fields[field_idx]; |
| 1145 | const name = getAstNode(field).name; | 1145 | const name = getAstNode(field).name; |
| 1146 | return name; | 1146 | return name; |
| 1147 | } | 1147 | } |
src/Autodoc.zig+19| ... | @@ -3616,6 +3616,25 @@ fn tryResolveRefPath( | ... | @@ -3616,6 +3616,25 @@ fn tryResolveRefPath( |
| 3616 | continue :outer; | 3616 | continue :outer; |
| 3617 | }, | 3617 | }, |
| 3618 | }, | 3618 | }, |
| 3619 | .@"struct" => |st| { | ||
| 3620 | for (st) |field| { | ||
| 3621 | if (std.mem.eql(u8, field.name, child_string)) { | ||
| 3622 | path[i + 1] = field.val.expr; | ||
| 3623 | continue :outer; | ||
| 3624 | } | ||
| 3625 | } | ||
| 3626 | |||
| 3627 | // if we got here, our search failed | ||
| 3628 | printWithContext( | ||
| 3629 | file, | ||
| 3630 | inst_index, | ||
| 3631 | "failed to match `{s}` in struct", | ||
| 3632 | .{child_string}, | ||
| 3633 | ); | ||
| 3634 | |||
| 3635 | path[i + 1] = (try self.cteTodo("match failure")).expr; | ||
| 3636 | continue :outer; | ||
| 3637 | }, | ||
| 3619 | } | 3638 | } |
| 3620 | } | 3639 | } |
| 3621 | 3640 |