fix: @TypeOf() now rendering

This commit is contained in:
Vallahor 2022-05-26 16:47:16 -03:00 committed by Andrew Kelley
parent e1d55385ff
commit 270e2c18bf
2 changed files with 12 additions and 5 deletions

View File

@ -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";
}

View File

@ -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