authorgravatar for vallahor91@gmail.comVallahor <vallahor91@gmail.com> 2022-05-26 16:47:16-03:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-19 19:10:11-07:00
log270e2c18bf4dde537361f40819fb8d3991249586
treec7bb9901c5d793e3a4f298e1855dda897777fea2
parente1d55385ff3916f2a522225c41a239068972fdf4

fix: @TypeOf() now rendering


2 files changed, 12 insertions(+), 5 deletions(-)

lib/docs/main.js+5
...@@ -1083,6 +1083,11 @@ var zigAnalysis;...@@ -1083,6 +1083,11 @@ var zigAnalysis;
1083 struct_body += "}";1083 struct_body += "}";
1084 return struct_body;1084 return struct_body;
1085 }1085 }
1086 case "typeOf": {
1087 const typeRefArg = zigAnalysis.exprs[expr.typeOf];
1088 let payloadHtml = "@TypeOf(" + exprName(typeRefArg) + ")";
1089 return payloadHtml;
1090 }
1086 case "null": {1091 case "null": {
1087 return "null";1092 return "null";
1088 }1093 }
src/Autodoc.zig+7-5
...@@ -1242,10 +1242,6 @@ fn walkInstruction(...@@ -1242,10 +1242,6 @@ fn walkInstruction(
1242 };1242 };
1243 },1243 },
1244 .typeof_builtin => {1244 .typeof_builtin => {
1245 // @check: @TypeOf(T)
1246 // right now it's only showing the T
1247 // a way to solve it could be creating a .call
1248 // another way is with a flag to handle it on Frontend
1249 const pl_node = data[inst_index].pl_node;1245 const pl_node = data[inst_index].pl_node;
1250 const extra = file.zir.extraData(Zir.Inst.Block, pl_node.payload_index);1246 const extra = file.zir.extraData(Zir.Inst.Block, pl_node.payload_index);
1251 const body = file.zir.extra[extra.end..][extra.data.body_len - 1];1247 const body = file.zir.extra[extra.end..][extra.data.body_len - 1];
...@@ -1257,7 +1253,13 @@ fn walkInstruction(...@@ -1257,7 +1253,13 @@ fn walkInstruction(
1257 false,1253 false,
1258 );1254 );
12591255
1260 return operand;1256 const operand_index = self.exprs.items.len;
1257 try self.exprs.append(self.arena, operand.expr);
1258
1259 return DocData.WalkResult{
1260 .typeRef = operand.typeRef,
1261 .expr = .{ .typeOf = operand_index },
1262 };
1261 },1263 },
1262 .type_info => {1264 .type_info => {
1263 // @check1265 // @check