remove z/Z format specifiers

Zig's format system is flexible enough to add custom formatters.  This PR removes the new z/Z format specifiers that were added for printing Zig identifiers and replaces them with custom formatters.
This commit is contained in:
Jonathan Marler
2021-01-03 13:49:51 -07:00
committed by Andrew Kelley
parent a9b505fa77
commit 31802c6c68
10 changed files with 153 additions and 110 deletions

View File

@@ -169,8 +169,8 @@ pub const DeclGen = struct {
.undef, .empty_struct_value, .empty_array => try writer.writeAll("{}"),
.bytes => {
const bytes = val.castTag(.bytes).?.data;
// TODO: make our own C string escape instead of using {Z}
try writer.print("\"{Z}\"", .{bytes});
// TODO: make our own C string escape instead of using std.zig.fmtEscapes
try writer.print("\"{}\"", .{std.zig.fmtEscapes(bytes)});
},
else => {
// Fall back to generic implementation.