Commit c5afefec42

Loris Cro <kappaloris@gmail.com>
2022-08-02 17:24:19
autodoc: fix autodoc analysis for `@typeInfo`
We were previously erroneously saving it as a `@TypeOf`.
1 parent 622714b
Changed files (2)
lib
docs
src
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";
           }
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 => {