authorgravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2023-10-04 18:25:00+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-10-04 18:25:00+02:00
log9c3165b81b1ee6474f4bdecf33149f587fd77510
tree389a1767aa7c4189223caca6829505d35fbb4c8c
parent9f0d2f94175a131d965e86a6396f5ac508b27bf8
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

autodoc: Add handling for array_cat, array_mul, struct_init_empty_result. (#17367)

Fix issue with getting docs for src-less types in main.js

2 files changed, 9 insertions(+), 6 deletions(-)

lib/docs/main.js+4-1
...@@ -3246,7 +3246,10 @@ Happy writing!...@@ -3246,7 +3246,10 @@ Happy writing!
3246 const definitionDecl = getDecl(seenDecls[seenDecls.length - 1]);3246 const definitionDecl = getDecl(seenDecls[seenDecls.length - 1]);
3247 docs = getAstNode(definitionDecl.src).docs;3247 docs = getAstNode(definitionDecl.src).docs;
3248 } else {3248 } else {
3249 docs = getAstNode(getType(value.expr.type).src).docs;3249 const type = getType(value.expr.type);
3250 if ("src" in type) {
3251 docs = getAstNode(type.src).docs;
3252 }
3250 }3253 }
3251 }3254 }
3252 3255
src/Autodoc.zig+5-5
...@@ -1547,7 +1547,6 @@ fn walkInstruction(...@@ -1547,7 +1547,6 @@ fn walkInstruction(
1547 };1547 };
1548 },1548 },
15491549
1550 // @check array_cat and array_mul
1551 .add,1550 .add,
1552 .addwrap,1551 .addwrap,
1553 .add_sat,1552 .add_sat,
...@@ -1564,9 +1563,8 @@ fn walkInstruction(...@@ -1564,9 +1563,8 @@ fn walkInstruction(
1564 .bit_or,1563 .bit_or,
1565 .bit_and,1564 .bit_and,
1566 .xor,1565 .xor,
1567 // @check still not working when applied in std1566 .array_cat,
1568 // .array_cat,1567 .array_mul,
1569 // .array_mul,
1570 => {1568 => {
1571 const pl_node = data[inst_index].pl_node;1569 const pl_node = data[inst_index].pl_node;
1572 const extra = file.zir.extraData(Zir.Inst.Bin, pl_node.payload_index);1570 const extra = file.zir.extraData(Zir.Inst.Bin, pl_node.payload_index);
...@@ -2881,7 +2879,9 @@ fn walkInstruction(...@@ -2881,7 +2879,9 @@ fn walkInstruction(
2881 .expr = .{ .@"struct" = field_vals },2879 .expr = .{ .@"struct" = field_vals },
2882 };2880 };
2883 },2881 },
2884 .struct_init_empty => {2882 .struct_init_empty,
2883 .struct_init_empty_result,
2884 => {
2885 const un_node = data[inst_index].un_node;2885 const un_node = data[inst_index].un_node;
28862886
2887 var operand: DocData.WalkResult = try self.walkRef(2887 var operand: DocData.WalkResult = try self.walkRef(