authorgravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2022-08-21 05:29:39+02:00
committergravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2022-08-21 05:29:39+02:00
loga02215795639294a723f8e5c5aa1d39a089962f3
tree8cbfa1c2d69b71fac524e1511a72bdc6c6d2ad12
parent4a98385b0aa3808ab05a1ebfbc90fd0bcd97c0d9

autodoc: compileError now uses index into `exprs` instead of a `[]const u8`


2 files changed, 6 insertions(+), 8 deletions(-)

lib/docs/main.js+1-1
......@@ -866,7 +866,7 @@ var zigAnalysis;
866866 }
867867 case "compileError": {
868868 let compileError = expr.compileError;
869 return compileError;
869 return "@compileError(" + exprName(zigAnalysis.exprs[compileError]) + ")";
870870 }
871871 case "enumLiteral": {
872872 let literal = expr.enumLiteral;
src/Autodoc.zig+5-7
......@@ -632,7 +632,7 @@ const DocData = struct {
632632 sizeOf: usize, // index in `exprs`
633633 bitSizeOf: usize, // index in `exprs`
634634 enumToInt: usize, // index in `exprs`
635 compileError: []const u8,
635 compileError: usize, //index in `exprs`
636636 errorSets: usize,
637637 string: []const u8, // direct value
638638 sliceIndex: usize,
......@@ -1027,13 +1027,11 @@ fn walkInstruction(
10271027 false,
10281028 );
10291029
1030 const operand_index = self.exprs.items.len;
1031 try self.exprs.append(self.arena, operand.expr);
1032
10301033 return DocData.WalkResult{
1031 .expr = .{
1032 .compileError = switch (operand.expr) {
1033 .string => |s| s,
1034 else => "TODO: non-string @compileError arguments",
1035 },
1036 },
1034 .expr = .{ .compileError = operand_index },
10371035 };
10381036 },
10391037 .enum_literal => {