mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
autodoc: add support for enum literals
This commit is contained in:
parent
056ba8e57c
commit
4f949163a5
@ -540,6 +540,7 @@ const DocData = struct {
|
||||
},
|
||||
array: Array,
|
||||
call: usize, // index in `calls`
|
||||
enumLiteral: []const u8,
|
||||
|
||||
const Struct = struct {
|
||||
typeRef: TypeRef,
|
||||
@ -613,6 +614,11 @@ const DocData = struct {
|
||||
options,
|
||||
w,
|
||||
),
|
||||
.enumLiteral => |v| try std.json.stringify(
|
||||
struct { @"enumLiteral": []const u8 }{ .@"enumLiteral" = v },
|
||||
options,
|
||||
w,
|
||||
),
|
||||
|
||||
// try w.print("{ len: {},\n", .{v.len});
|
||||
|
||||
@ -685,7 +691,11 @@ fn walkInstruction(
|
||||
|
||||
return new_file_walk_result;
|
||||
},
|
||||
|
||||
.enum_literal => {
|
||||
const str_tok = data[inst_index].str_tok;
|
||||
const literal = file.zir.nullTerminatedString(str_tok.start);
|
||||
return DocData.WalkResult{ .enumLiteral = literal };
|
||||
},
|
||||
.int => {
|
||||
const int = data[inst_index].int;
|
||||
return DocData.WalkResult{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user