From c5afefec427f2f2aeb25fe8f7114b5a0a6aa1129 Mon Sep 17 00:00:00 2001 From: Loris Cro Date: Tue, 2 Aug 2022 17:24:19 +0200 Subject: [PATCH] autodoc: fix autodoc analysis for `@typeInfo` We were previously erroneously saving it as a `@TypeOf`. --- lib/docs/main.js | 5 +++++ src/Autodoc.zig | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/docs/main.js b/lib/docs/main.js index 31f91a8445..5435efd647 100644 --- a/lib/docs/main.js +++ b/lib/docs/main.js @@ -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"; } diff --git a/src/Autodoc.zig b/src/Autodoc.zig index 2d163bf4f0..1ed2694553 100644 --- a/src/Autodoc.zig +++ b/src/Autodoc.zig @@ -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 => {