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;...@@ -866,7 +866,7 @@ var zigAnalysis;
866 }866 }
867 case "compileError": {867 case "compileError": {
868 let compileError = expr.compileError;868 let compileError = expr.compileError;
869 return compileError;869 return "@compileError(" + exprName(zigAnalysis.exprs[compileError]) + ")";
870 }870 }
871 case "enumLiteral": {871 case "enumLiteral": {
872 let literal = expr.enumLiteral;872 let literal = expr.enumLiteral;
src/Autodoc.zig+5-7
...@@ -632,7 +632,7 @@ const DocData = struct {...@@ -632,7 +632,7 @@ const DocData = struct {
632 sizeOf: usize, // index in `exprs`632 sizeOf: usize, // index in `exprs`
633 bitSizeOf: usize, // index in `exprs`633 bitSizeOf: usize, // index in `exprs`
634 enumToInt: usize, // index in `exprs`634 enumToInt: usize, // index in `exprs`
635 compileError: []const u8,635 compileError: usize, //index in `exprs`
636 errorSets: usize,636 errorSets: usize,
637 string: []const u8, // direct value637 string: []const u8, // direct value
638 sliceIndex: usize,638 sliceIndex: usize,
...@@ -1027,13 +1027,11 @@ fn walkInstruction(...@@ -1027,13 +1027,11 @@ fn walkInstruction(
1027 false,1027 false,
1028 );1028 );
10291029
1030 const operand_index = self.exprs.items.len;
1031 try self.exprs.append(self.arena, operand.expr);
1032
1030 return DocData.WalkResult{1033 return DocData.WalkResult{
1031 .expr = .{1034 .expr = .{ .compileError = operand_index },
1032 .compileError = switch (operand.expr) {
1033 .string => |s| s,
1034 else => "TODO: non-string @compileError arguments",
1035 },
1036 },
1037 };1035 };
1038 },1036 },
1039 .enum_literal => {1037 .enum_literal => {