Commit 270e2c18bf

Vallahor <vallahor91@gmail.com>
2022-05-26 21:47:16
fix: @TypeOf() now rendering
1 parent e1d5538
Changed files (2)
lib
docs
src
lib/docs/main.js
@@ -1083,6 +1083,11 @@ var zigAnalysis;
               struct_body += "}";
             return struct_body;
           }
+          case "typeOf": {
+            const typeRefArg = zigAnalysis.exprs[expr.typeOf];
+            let payloadHtml = "@TypeOf(" + exprName(typeRefArg) + ")";
+            return payloadHtml;
+          }
           case "null": {
             return "null";
           }
src/Autodoc.zig
@@ -1242,10 +1242,6 @@ fn walkInstruction(
             };
         },
         .typeof_builtin => {
-            // @check: @TypeOf(T)
-            // right now it's only showing the T
-            // a way to solve it could be creating a .call
-            // another way is with a flag to handle it on Frontend
             const pl_node = data[inst_index].pl_node;
             const extra = file.zir.extraData(Zir.Inst.Block, pl_node.payload_index);
             const body = file.zir.extra[extra.end..][extra.data.body_len - 1];
@@ -1257,7 +1253,13 @@ fn walkInstruction(
                 false,
             );
 
-            return operand;
+            const operand_index = self.exprs.items.len;
+            try self.exprs.append(self.arena, operand.expr);
+
+            return DocData.WalkResult{
+                .typeRef = operand.typeRef,
+                .expr = .{ .typeOf = operand_index },
+            };
         },
         .type_info => {
             // @check