authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2022-08-23 15:46:26+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-08-23 15:46:26+02:00
logd635dcacbf2d8ab8af97e75fda69b66e7b1ea1cf
treef23fc9ac9462b74f3b6cd16dffff1152170d561e
parent8c27e7ed916dfdc7d2727ac28c5119a27c45818e
parent76c9ee9b303937aef62f5ad10eab7ff56d607e34
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #12542 from der-teufel-programming/compileError-input

autodoc: show compileErrors correctly

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], opts) + ")";
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 => {