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