autodoc: fix autodoc analysis for @typeInfo

We were previously erroneously saving it as a `@TypeOf`.
This commit is contained in:
Loris Cro 2022-08-02 17:24:19 +02:00
parent 622714b76b
commit c5afefec42
2 changed files with 7 additions and 1 deletions

View File

@ -1403,6 +1403,11 @@ var zigAnalysis;
let payloadHtml = "@TypeOf(" + exprName(typeRefArg, {wantHtml: true, wantLink:true}) + ")";
return payloadHtml;
}
case "typeInfo": {
const typeRefArg = zigAnalysis.exprs[expr.typeInfo];
let payloadHtml = "@typeInfo(" + exprName(typeRefArg, {wantHtml: true, wantLink:true}) + ")";
return payloadHtml;
}
case "null": {
return "null";
}

View File

@ -580,6 +580,7 @@ const DocData = struct {
enumLiteral: []const u8, // direct value
alignOf: usize, // index in `exprs`
typeOf: usize, // index in `exprs`
typeInfo: usize, // index in `exprs`
typeOf_peer: []usize,
errorUnion: usize, // index in `exprs`
as: As,
@ -1788,7 +1789,7 @@ fn walkInstruction(
return DocData.WalkResult{
.typeRef = operand.typeRef,
.expr = .{ .typeOf = operand_index },
.expr = .{ .typeInfo = operand_index },
};
},
.as_node => {