| author | |
| committer | |
| log | b8124d9c0b01e8ac7cd0daf93a0ed018da5f2352 |
| tree | 37ff66d809c8817ebd60871c4c296a269032b60f |
| parent | 7abd62800cde3f42c0ef65126ed478a0c3d3d549 |
This "get" is useless noise and was copied from FixedBufferWriter.
Since this API has not yet landed in a release, now is a good time
to make the breaking change to fix this.25 files changed, 202 insertions(+), 202 deletions(-)
lib/docs/wasm/Walk.zig+1-1| ... | @@ -443,7 +443,7 @@ fn parse(file_name: []const u8, source: []u8) Oom!Ast { | ... | @@ -443,7 +443,7 @@ fn parse(file_name: []const u8, source: []u8) Oom!Ast { |
| 443 | error.WriteFailed => return error.OutOfMemory, | 443 | error.WriteFailed => return error.OutOfMemory, |
| 444 | }; | 444 | }; |
| 445 | log.err("{s}:{d}:{d}: {s}", .{ | 445 | log.err("{s}:{d}:{d}: {s}", .{ |
| 446 | file_name, err_loc.line + 1, err_loc.column + 1, rendered_err.getWritten(), | 446 | file_name, err_loc.line + 1, err_loc.column + 1, rendered_err.written(), |
| 447 | }); | 447 | }); |
| 448 | } | 448 | } |
| 449 | return Ast.parse(gpa, "", .zig); | 449 | return Ast.parse(gpa, "", .zig); |
lib/std/Build/Step/ConfigHeader.zig+4-4| ... | @@ -239,7 +239,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { | ... | @@ -239,7 +239,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { |
| 239 | }, | 239 | }, |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | const output = aw.getWritten(); | 242 | const output = aw.written(); |
| 243 | man.hash.addBytes(output); | 243 | man.hash.addBytes(output); |
| 244 | 244 | ||
| 245 | if (try step.cacheHit(&man)) { | 245 | if (try step.cacheHit(&man)) { |
| ... | @@ -347,10 +347,10 @@ fn render_autoconf_at( | ... | @@ -347,10 +347,10 @@ fn render_autoconf_at( |
| 347 | while (line_it.next()) |line| : (line_index += 1) { | 347 | while (line_it.next()) |line| : (line_index += 1) { |
| 348 | const last_line = line_it.index == line_it.buffer.len; | 348 | const last_line = line_it.index == line_it.buffer.len; |
| 349 | 349 | ||
| 350 | const old_len = aw.getWritten().len; | 350 | const old_len = aw.written().len; |
| 351 | expand_variables_autoconf_at(bw, line, values, used) catch |err| switch (err) { | 351 | expand_variables_autoconf_at(bw, line, values, used) catch |err| switch (err) { |
| 352 | error.MissingValue => { | 352 | error.MissingValue => { |
| 353 | const name = aw.getWritten()[old_len..]; | 353 | const name = aw.written()[old_len..]; |
| 354 | defer aw.shrinkRetainingCapacity(old_len); | 354 | defer aw.shrinkRetainingCapacity(old_len); |
| 355 | try step.addError("{s}:{d}: error: unspecified config header value: '{s}'", .{ | 355 | try step.addError("{s}:{d}: error: unspecified config header value: '{s}'", .{ |
| 356 | src_path, line_index + 1, name, | 356 | src_path, line_index + 1, name, |
| ... | @@ -763,7 +763,7 @@ fn testReplaceVariablesAutoconfAt( | ... | @@ -763,7 +763,7 @@ fn testReplaceVariablesAutoconfAt( |
| 763 | try expand_variables_autoconf_at(&aw.writer, contents, values, used); | 763 | try expand_variables_autoconf_at(&aw.writer, contents, values, used); |
| 764 | 764 | ||
| 765 | for (used) |u| if (!u) return error.UnusedValue; | 765 | for (used) |u| if (!u) return error.UnusedValue; |
| 766 | try std.testing.expectEqualStrings(expected, aw.getWritten()); | 766 | try std.testing.expectEqualStrings(expected, aw.written()); |
| 767 | } | 767 | } |
| 768 | 768 | ||
| 769 | fn testReplaceVariablesCMake( | 769 | fn testReplaceVariablesCMake( |
lib/std/Io/Writer.zig+2-2| ... | @@ -2557,7 +2557,7 @@ pub const Allocating = struct { | ... | @@ -2557,7 +2557,7 @@ pub const Allocating = struct { |
| 2557 | return list.toOwnedSliceSentinel(gpa, sentinel); | 2557 | return list.toOwnedSliceSentinel(gpa, sentinel); |
| 2558 | } | 2558 | } |
| 2559 | 2559 | ||
| 2560 | pub fn getWritten(a: *Allocating) []u8 { | 2560 | pub fn written(a: *Allocating) []u8 { |
| 2561 | return a.writer.buffered(); | 2561 | return a.writer.buffered(); |
| 2562 | } | 2562 | } |
| 2563 | 2563 | ||
| ... | @@ -2624,7 +2624,7 @@ pub const Allocating = struct { | ... | @@ -2624,7 +2624,7 @@ pub const Allocating = struct { |
| 2624 | const y: i32 = 1234; | 2624 | const y: i32 = 1234; |
| 2625 | try w.print("x: {}\ny: {}\n", .{ x, y }); | 2625 | try w.print("x: {}\ny: {}\n", .{ x, y }); |
| 2626 | 2626 | ||
| 2627 | try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", a.getWritten()); | 2627 | try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", a.written()); |
| 2628 | } | 2628 | } |
| 2629 | }; | 2629 | }; |
| 2630 | 2630 |
lib/std/compress/flate/Decompress.zig+1-1| ... | @@ -1272,5 +1272,5 @@ fn testDecompress(container: Container, compressed: []const u8, expected_plain: | ... | @@ -1272,5 +1272,5 @@ fn testDecompress(container: Container, compressed: []const u8, expected_plain: |
| 1272 | var decompress: Decompress = .init(&in, container, &.{}); | 1272 | var decompress: Decompress = .init(&in, container, &.{}); |
| 1273 | const decompressed_len = try decompress.reader.streamRemaining(&aw.writer); | 1273 | const decompressed_len = try decompress.reader.streamRemaining(&aw.writer); |
| 1274 | try testing.expectEqual(expected_plain.len, decompressed_len); | 1274 | try testing.expectEqual(expected_plain.len, decompressed_len); |
| 1275 | try testing.expectEqualSlices(u8, expected_plain, aw.getWritten()); | 1275 | try testing.expectEqualSlices(u8, expected_plain, aw.written()); |
| 1276 | } | 1276 | } |
lib/std/debug.zig+11-11| ... | @@ -318,7 +318,7 @@ test dumpHexFallible { | ... | @@ -318,7 +318,7 @@ test dumpHexFallible { |
| 318 | @sizeOf(usize) * 2, | 318 | @sizeOf(usize) * 2, |
| 319 | }); | 319 | }); |
| 320 | defer std.testing.allocator.free(expected); | 320 | defer std.testing.allocator.free(expected); |
| 321 | try std.testing.expectEqualStrings(expected, aw.getWritten()); | 321 | try std.testing.expectEqualStrings(expected, aw.written()); |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | /// Tries to print the current stack trace to stderr, unbuffered, and ignores any error returned. | 324 | /// Tries to print the current stack trace to stderr, unbuffered, and ignores any error returned. |
| ... | @@ -1258,7 +1258,7 @@ test printLineFromFileAnyOs { | ... | @@ -1258,7 +1258,7 @@ test printLineFromFileAnyOs { |
| 1258 | try expectError(error.EndOfFile, printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 2, .column = 0 })); | 1258 | try expectError(error.EndOfFile, printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 2, .column = 0 })); |
| 1259 | 1259 | ||
| 1260 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 }); | 1260 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 }); |
| 1261 | try expectEqualStrings("no new lines in this file, but one is printed anyway\n", aw.getWritten()); | 1261 | try expectEqualStrings("no new lines in this file, but one is printed anyway\n", aw.written()); |
| 1262 | aw.clearRetainingCapacity(); | 1262 | aw.clearRetainingCapacity(); |
| 1263 | } | 1263 | } |
| 1264 | { | 1264 | { |
| ... | @@ -1274,11 +1274,11 @@ test printLineFromFileAnyOs { | ... | @@ -1274,11 +1274,11 @@ test printLineFromFileAnyOs { |
| 1274 | }); | 1274 | }); |
| 1275 | 1275 | ||
| 1276 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 }); | 1276 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 }); |
| 1277 | try expectEqualStrings("1\n", aw.getWritten()); | 1277 | try expectEqualStrings("1\n", aw.written()); |
| 1278 | aw.clearRetainingCapacity(); | 1278 | aw.clearRetainingCapacity(); |
| 1279 | 1279 | ||
| 1280 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 3, .column = 0 }); | 1280 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 3, .column = 0 }); |
| 1281 | try expectEqualStrings("3\n", aw.getWritten()); | 1281 | try expectEqualStrings("3\n", aw.written()); |
| 1282 | aw.clearRetainingCapacity(); | 1282 | aw.clearRetainingCapacity(); |
| 1283 | } | 1283 | } |
| 1284 | { | 1284 | { |
| ... | @@ -1297,7 +1297,7 @@ test printLineFromFileAnyOs { | ... | @@ -1297,7 +1297,7 @@ test printLineFromFileAnyOs { |
| 1297 | try writer.flush(); | 1297 | try writer.flush(); |
| 1298 | 1298 | ||
| 1299 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 2, .column = 0 }); | 1299 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 2, .column = 0 }); |
| 1300 | try expectEqualStrings(("a" ** overlap) ++ "\n", aw.getWritten()); | 1300 | try expectEqualStrings(("a" ** overlap) ++ "\n", aw.written()); |
| 1301 | aw.clearRetainingCapacity(); | 1301 | aw.clearRetainingCapacity(); |
| 1302 | } | 1302 | } |
| 1303 | { | 1303 | { |
| ... | @@ -1311,7 +1311,7 @@ test printLineFromFileAnyOs { | ... | @@ -1311,7 +1311,7 @@ test printLineFromFileAnyOs { |
| 1311 | try writer.splatByteAll('a', std.heap.page_size_max); | 1311 | try writer.splatByteAll('a', std.heap.page_size_max); |
| 1312 | 1312 | ||
| 1313 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 }); | 1313 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 }); |
| 1314 | try expectEqualStrings(("a" ** std.heap.page_size_max) ++ "\n", aw.getWritten()); | 1314 | try expectEqualStrings(("a" ** std.heap.page_size_max) ++ "\n", aw.written()); |
| 1315 | aw.clearRetainingCapacity(); | 1315 | aw.clearRetainingCapacity(); |
| 1316 | } | 1316 | } |
| 1317 | { | 1317 | { |
| ... | @@ -1327,17 +1327,17 @@ test printLineFromFileAnyOs { | ... | @@ -1327,17 +1327,17 @@ test printLineFromFileAnyOs { |
| 1327 | try expectError(error.EndOfFile, printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 2, .column = 0 })); | 1327 | try expectError(error.EndOfFile, printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 2, .column = 0 })); |
| 1328 | 1328 | ||
| 1329 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 }); | 1329 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 }); |
| 1330 | try expectEqualStrings(("a" ** (3 * std.heap.page_size_max)) ++ "\n", aw.getWritten()); | 1330 | try expectEqualStrings(("a" ** (3 * std.heap.page_size_max)) ++ "\n", aw.written()); |
| 1331 | aw.clearRetainingCapacity(); | 1331 | aw.clearRetainingCapacity(); |
| 1332 | 1332 | ||
| 1333 | try writer.writeAll("a\na"); | 1333 | try writer.writeAll("a\na"); |
| 1334 | 1334 | ||
| 1335 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 }); | 1335 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 1, .column = 0 }); |
| 1336 | try expectEqualStrings(("a" ** (3 * std.heap.page_size_max)) ++ "a\n", aw.getWritten()); | 1336 | try expectEqualStrings(("a" ** (3 * std.heap.page_size_max)) ++ "a\n", aw.written()); |
| 1337 | aw.clearRetainingCapacity(); | 1337 | aw.clearRetainingCapacity(); |
| 1338 | 1338 | ||
| 1339 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 2, .column = 0 }); | 1339 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = 2, .column = 0 }); |
| 1340 | try expectEqualStrings("a\n", aw.getWritten()); | 1340 | try expectEqualStrings("a\n", aw.written()); |
| 1341 | aw.clearRetainingCapacity(); | 1341 | aw.clearRetainingCapacity(); |
| 1342 | } | 1342 | } |
| 1343 | { | 1343 | { |
| ... | @@ -1353,11 +1353,11 @@ test printLineFromFileAnyOs { | ... | @@ -1353,11 +1353,11 @@ test printLineFromFileAnyOs { |
| 1353 | try writer.writeAll("abc\ndef"); | 1353 | try writer.writeAll("abc\ndef"); |
| 1354 | 1354 | ||
| 1355 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = real_file_start + 1, .column = 0 }); | 1355 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = real_file_start + 1, .column = 0 }); |
| 1356 | try expectEqualStrings("abc\n", aw.getWritten()); | 1356 | try expectEqualStrings("abc\n", aw.written()); |
| 1357 | aw.clearRetainingCapacity(); | 1357 | aw.clearRetainingCapacity(); |
| 1358 | 1358 | ||
| 1359 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = real_file_start + 2, .column = 0 }); | 1359 | try printLineFromFileAnyOs(output_stream, .{ .file_name = path, .line = real_file_start + 2, .column = 0 }); |
| 1360 | try expectEqualStrings("def\n", aw.getWritten()); | 1360 | try expectEqualStrings("def\n", aw.written()); |
| 1361 | aw.clearRetainingCapacity(); | 1361 | aw.clearRetainingCapacity(); |
| 1362 | } | 1362 | } |
| 1363 | } | 1363 | } |
lib/std/http/test.zig+1-1| ... | @@ -1020,7 +1020,7 @@ fn echoTests(client: *http.Client, port: u16) !void { | ... | @@ -1020,7 +1020,7 @@ fn echoTests(client: *http.Client, port: u16) !void { |
| 1020 | .response_writer = &body.writer, | 1020 | .response_writer = &body.writer, |
| 1021 | }); | 1021 | }); |
| 1022 | try expectEqual(.ok, res.status); | 1022 | try expectEqual(.ok, res.status); |
| 1023 | try expectEqualStrings("Hello, World!\n", body.getWritten()); | 1023 | try expectEqualStrings("Hello, World!\n", body.written()); |
| 1024 | } | 1024 | } |
| 1025 | 1025 | ||
| 1026 | { // expect: 100-continue | 1026 | { // expect: 100-continue |
lib/std/json.zig+1-1| ... | @@ -57,7 +57,7 @@ test Stringify { | ... | @@ -57,7 +57,7 @@ test Stringify { |
| 57 | \\ "foo": 123 | 57 | \\ "foo": 123 |
| 58 | \\} | 58 | \\} |
| 59 | ; | 59 | ; |
| 60 | try testing.expectEqualSlices(u8, expected, out.getWritten()); | 60 | try testing.expectEqualSlices(u8, expected, out.written()); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | pub const ObjectMap = @import("json/dynamic.zig").ObjectMap; | 63 | pub const ObjectMap = @import("json/dynamic.zig").ObjectMap; |
lib/std/json/Stringify.zig+1-1| ... | @@ -582,7 +582,7 @@ test value { | ... | @@ -582,7 +582,7 @@ test value { |
| 582 | 582 | ||
| 583 | const T = struct { a: i32, b: []const u8 }; | 583 | const T = struct { a: i32, b: []const u8 }; |
| 584 | try value(T{ .a = 123, .b = "xy" }, .{}, writer); | 584 | try value(T{ .a = 123, .b = "xy" }, .{}, writer); |
| 585 | try std.testing.expectEqualSlices(u8, "{\"a\":123,\"b\":\"xy\"}", out.getWritten()); | 585 | try std.testing.expectEqualSlices(u8, "{\"a\":123,\"b\":\"xy\"}", out.written()); |
| 586 | 586 | ||
| 587 | try testStringify("9999999999999999", 9999999999999999, .{}); | 587 | try testStringify("9999999999999999", 9999999999999999, .{}); |
| 588 | try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true }); | 588 | try testStringify("\"9999999999999999\"", 9999999999999999, .{ .emit_nonportable_numbers_as_strings = true }); |
lib/std/tar/Writer.zig+4-4| ... | @@ -403,7 +403,7 @@ test "write files" { | ... | @@ -403,7 +403,7 @@ test "write files" { |
| 403 | for (files) |file| | 403 | for (files) |file| |
| 404 | try w.writeFileBytes(file.path, file.content, .{}); | 404 | try w.writeFileBytes(file.path, file.content, .{}); |
| 405 | 405 | ||
| 406 | var input: std.Io.Reader = .fixed(output.getWritten()); | 406 | var input: std.Io.Reader = .fixed(output.written()); |
| 407 | var it: std.tar.Iterator = .init(&input, .{ | 407 | var it: std.tar.Iterator = .init(&input, .{ |
| 408 | .file_name_buffer = &file_name_buffer, | 408 | .file_name_buffer = &file_name_buffer, |
| 409 | .link_name_buffer = &link_name_buffer, | 409 | .link_name_buffer = &link_name_buffer, |
| ... | @@ -427,7 +427,7 @@ test "write files" { | ... | @@ -427,7 +427,7 @@ test "write files" { |
| 427 | var content: std.Io.Writer.Allocating = .init(testing.allocator); | 427 | var content: std.Io.Writer.Allocating = .init(testing.allocator); |
| 428 | defer content.deinit(); | 428 | defer content.deinit(); |
| 429 | try it.streamRemaining(actual, &content.writer); | 429 | try it.streamRemaining(actual, &content.writer); |
| 430 | try testing.expectEqualSlices(u8, expected.content, content.getWritten()); | 430 | try testing.expectEqualSlices(u8, expected.content, content.written()); |
| 431 | } | 431 | } |
| 432 | } | 432 | } |
| 433 | // without root | 433 | // without root |
| ... | @@ -440,7 +440,7 @@ test "write files" { | ... | @@ -440,7 +440,7 @@ test "write files" { |
| 440 | try w.writeFileStream(file.path, file.content.len, &content, .{}); | 440 | try w.writeFileStream(file.path, file.content.len, &content, .{}); |
| 441 | } | 441 | } |
| 442 | 442 | ||
| 443 | var input: std.Io.Reader = .fixed(output.getWritten()); | 443 | var input: std.Io.Reader = .fixed(output.written()); |
| 444 | var it: std.tar.Iterator = .init(&input, .{ | 444 | var it: std.tar.Iterator = .init(&input, .{ |
| 445 | .file_name_buffer = &file_name_buffer, | 445 | .file_name_buffer = &file_name_buffer, |
| 446 | .link_name_buffer = &link_name_buffer, | 446 | .link_name_buffer = &link_name_buffer, |
| ... | @@ -455,7 +455,7 @@ test "write files" { | ... | @@ -455,7 +455,7 @@ test "write files" { |
| 455 | var content: std.Io.Writer.Allocating = .init(testing.allocator); | 455 | var content: std.Io.Writer.Allocating = .init(testing.allocator); |
| 456 | defer content.deinit(); | 456 | defer content.deinit(); |
| 457 | try it.streamRemaining(actual, &content.writer); | 457 | try it.streamRemaining(actual, &content.writer); |
| 458 | try testing.expectEqualSlices(u8, expected.content, content.getWritten()); | 458 | try testing.expectEqualSlices(u8, expected.content, content.written()); |
| 459 | } | 459 | } |
| 460 | try w.finishPedantically(); | 460 | try w.finishPedantically(); |
| 461 | } | 461 | } |
lib/std/tar/test.zig+1-1| ... | @@ -361,7 +361,7 @@ fn testCase(case: Case) !void { | ... | @@ -361,7 +361,7 @@ fn testCase(case: Case) !void { |
| 361 | var aw: std.Io.Writer.Allocating = .init(std.testing.allocator); | 361 | var aw: std.Io.Writer.Allocating = .init(std.testing.allocator); |
| 362 | defer aw.deinit(); | 362 | defer aw.deinit(); |
| 363 | try it.streamRemaining(actual, &aw.writer); | 363 | try it.streamRemaining(actual, &aw.writer); |
| 364 | const chksum = std.fmt.bytesToHex(std.crypto.hash.Md5.hashResult(aw.getWritten()), .lower); | 364 | const chksum = std.fmt.bytesToHex(std.crypto.hash.Md5.hashResult(aw.written()), .lower); |
| 365 | try testing.expectEqualStrings(case.chksums[i], &chksum); | 365 | try testing.expectEqualStrings(case.chksums[i], &chksum); |
| 366 | } else { | 366 | } else { |
| 367 | if (expected.truncated) { | 367 | if (expected.truncated) { |
lib/std/zig/Ast/Render.zig+5-5| ... | @@ -2189,12 +2189,12 @@ fn renderArrayInit( | ... | @@ -2189,12 +2189,12 @@ fn renderArrayInit( |
| 2189 | var single_line = true; | 2189 | var single_line = true; |
| 2190 | var contains_newline = false; | 2190 | var contains_newline = false; |
| 2191 | for (section_exprs, 0..) |expr, i| { | 2191 | for (section_exprs, 0..) |expr, i| { |
| 2192 | const start = sub_expr_buffer.getWritten().len; | 2192 | const start = sub_expr_buffer.written().len; |
| 2193 | sub_expr_buffer_starts[i] = start; | 2193 | sub_expr_buffer_starts[i] = start; |
| 2194 | 2194 | ||
| 2195 | if (i + 1 < section_exprs.len) { | 2195 | if (i + 1 < section_exprs.len) { |
| 2196 | try renderExpression(&sub_render, expr, .none); | 2196 | try renderExpression(&sub_render, expr, .none); |
| 2197 | const written = sub_expr_buffer.getWritten(); | 2197 | const written = sub_expr_buffer.written(); |
| 2198 | const width = written.len - start; | 2198 | const width = written.len - start; |
| 2199 | const this_contains_newline = mem.indexOfScalar(u8, written[start..], '\n') != null; | 2199 | const this_contains_newline = mem.indexOfScalar(u8, written[start..], '\n') != null; |
| 2200 | contains_newline = contains_newline or this_contains_newline; | 2200 | contains_newline = contains_newline or this_contains_newline; |
| ... | @@ -2218,7 +2218,7 @@ fn renderArrayInit( | ... | @@ -2218,7 +2218,7 @@ fn renderArrayInit( |
| 2218 | try renderExpression(&sub_render, expr, .comma); | 2218 | try renderExpression(&sub_render, expr, .comma); |
| 2219 | ais.popSpace(); | 2219 | ais.popSpace(); |
| 2220 | 2220 | ||
| 2221 | const written = sub_expr_buffer.getWritten(); | 2221 | const written = sub_expr_buffer.written(); |
| 2222 | const width = written.len - start - 2; | 2222 | const width = written.len - start - 2; |
| 2223 | const this_contains_newline = mem.indexOfScalar(u8, written[start .. written.len - 1], '\n') != null; | 2223 | const this_contains_newline = mem.indexOfScalar(u8, written[start .. written.len - 1], '\n') != null; |
| 2224 | contains_newline = contains_newline or this_contains_newline; | 2224 | contains_newline = contains_newline or this_contains_newline; |
| ... | @@ -2231,14 +2231,14 @@ fn renderArrayInit( | ... | @@ -2231,14 +2231,14 @@ fn renderArrayInit( |
| 2231 | } | 2231 | } |
| 2232 | } | 2232 | } |
| 2233 | } | 2233 | } |
| 2234 | sub_expr_buffer_starts[section_exprs.len] = sub_expr_buffer.getWritten().len; | 2234 | sub_expr_buffer_starts[section_exprs.len] = sub_expr_buffer.written().len; |
| 2235 | 2235 | ||
| 2236 | // Render exprs in current section. | 2236 | // Render exprs in current section. |
| 2237 | column_counter = 0; | 2237 | column_counter = 0; |
| 2238 | for (section_exprs, 0..) |expr, i| { | 2238 | for (section_exprs, 0..) |expr, i| { |
| 2239 | const start = sub_expr_buffer_starts[i]; | 2239 | const start = sub_expr_buffer_starts[i]; |
| 2240 | const end = sub_expr_buffer_starts[i + 1]; | 2240 | const end = sub_expr_buffer_starts[i + 1]; |
| 2241 | const expr_text = sub_expr_buffer.getWritten()[start..end]; | 2241 | const expr_text = sub_expr_buffer.written()[start..end]; |
| 2242 | if (!expr_newlines[i]) { | 2242 | if (!expr_newlines[i]) { |
| 2243 | try ais.writeAll(expr_text); | 2243 | try ais.writeAll(expr_text); |
| 2244 | } else { | 2244 | } else { |
lib/std/zig/AstGen.zig+4-4| ... | @@ -13765,19 +13765,19 @@ fn lowerAstErrors(astgen: *AstGen) error{OutOfMemory}!void { | ... | @@ -13765,19 +13765,19 @@ fn lowerAstErrors(astgen: *AstGen) error{OutOfMemory}!void { |
| 13765 | }; | 13765 | }; |
| 13766 | msg.clearRetainingCapacity(); | 13766 | msg.clearRetainingCapacity(); |
| 13767 | tree.renderError(ast_err, msg_w) catch return error.OutOfMemory; | 13767 | tree.renderError(ast_err, msg_w) catch return error.OutOfMemory; |
| 13768 | return try astgen.appendErrorTokNotesOff(tok, bad_off, "{s}", .{msg.getWritten()}, notes.items); | 13768 | return try astgen.appendErrorTokNotesOff(tok, bad_off, "{s}", .{msg.written()}, notes.items); |
| 13769 | } | 13769 | } |
| 13770 | 13770 | ||
| 13771 | var cur_err = tree.errors[0]; | 13771 | var cur_err = tree.errors[0]; |
| 13772 | for (tree.errors[1..]) |err| { | 13772 | for (tree.errors[1..]) |err| { |
| 13773 | if (err.is_note) { | 13773 | if (err.is_note) { |
| 13774 | tree.renderError(err, msg_w) catch return error.OutOfMemory; | 13774 | tree.renderError(err, msg_w) catch return error.OutOfMemory; |
| 13775 | try notes.append(gpa, try astgen.errNoteTok(err.token, "{s}", .{msg.getWritten()})); | 13775 | try notes.append(gpa, try astgen.errNoteTok(err.token, "{s}", .{msg.written()})); |
| 13776 | } else { | 13776 | } else { |
| 13777 | // Flush error | 13777 | // Flush error |
| 13778 | const extra_offset = tree.errorOffset(cur_err); | 13778 | const extra_offset = tree.errorOffset(cur_err); |
| 13779 | tree.renderError(cur_err, msg_w) catch return error.OutOfMemory; | 13779 | tree.renderError(cur_err, msg_w) catch return error.OutOfMemory; |
| 13780 | try astgen.appendErrorTokNotesOff(cur_err.token, extra_offset, "{s}", .{msg.getWritten()}, notes.items); | 13780 | try astgen.appendErrorTokNotesOff(cur_err.token, extra_offset, "{s}", .{msg.written()}, notes.items); |
| 13781 | notes.clearRetainingCapacity(); | 13781 | notes.clearRetainingCapacity(); |
| 13782 | cur_err = err; | 13782 | cur_err = err; |
| 13783 | 13783 | ||
| ... | @@ -13791,7 +13791,7 @@ fn lowerAstErrors(astgen: *AstGen) error{OutOfMemory}!void { | ... | @@ -13791,7 +13791,7 @@ fn lowerAstErrors(astgen: *AstGen) error{OutOfMemory}!void { |
| 13791 | // Flush error | 13791 | // Flush error |
| 13792 | const extra_offset = tree.errorOffset(cur_err); | 13792 | const extra_offset = tree.errorOffset(cur_err); |
| 13793 | tree.renderError(cur_err, msg_w) catch return error.OutOfMemory; | 13793 | tree.renderError(cur_err, msg_w) catch return error.OutOfMemory; |
| 13794 | try astgen.appendErrorTokNotesOff(cur_err.token, extra_offset, "{s}", .{msg.getWritten()}, notes.items); | 13794 | try astgen.appendErrorTokNotesOff(cur_err.token, extra_offset, "{s}", .{msg.written()}, notes.items); |
| 13795 | } | 13795 | } |
| 13796 | 13796 | ||
| 13797 | const DeclarationName = union(enum) { | 13797 | const DeclarationName = union(enum) { |
lib/std/zig/ErrorBundle.zig+1-1| ... | @@ -817,6 +817,6 @@ pub const Wip = struct { | ... | @@ -817,6 +817,6 @@ pub const Wip = struct { |
| 817 | defer copy_buf.deinit(); | 817 | defer copy_buf.deinit(); |
| 818 | try copy.renderToWriter(.{ .ttyconf = ttyconf }, copy_bw); | 818 | try copy.renderToWriter(.{ .ttyconf = ttyconf }, copy_bw); |
| 819 | 819 | ||
| 820 | try std.testing.expectEqualStrings(bundle_bw.getWritten(), copy_bw.getWritten()); | 820 | try std.testing.expectEqualStrings(bundle_bw.written(), copy_bw.written()); |
| 821 | } | 821 | } |
| 822 | }; | 822 | }; |
lib/std/zig/ZonGen.zig+3-3| ... | @@ -896,12 +896,12 @@ fn lowerAstErrors(zg: *ZonGen) Allocator.Error!void { | ... | @@ -896,12 +896,12 @@ fn lowerAstErrors(zg: *ZonGen) Allocator.Error!void { |
| 896 | for (tree.errors[1..]) |err| { | 896 | for (tree.errors[1..]) |err| { |
| 897 | if (err.is_note) { | 897 | if (err.is_note) { |
| 898 | tree.renderError(err, msg_bw) catch return error.OutOfMemory; | 898 | tree.renderError(err, msg_bw) catch return error.OutOfMemory; |
| 899 | try notes.append(gpa, try zg.errNoteTok(err.token, "{s}", .{msg.getWritten()})); | 899 | try notes.append(gpa, try zg.errNoteTok(err.token, "{s}", .{msg.written()})); |
| 900 | } else { | 900 | } else { |
| 901 | // Flush error | 901 | // Flush error |
| 902 | tree.renderError(cur_err, msg_bw) catch return error.OutOfMemory; | 902 | tree.renderError(cur_err, msg_bw) catch return error.OutOfMemory; |
| 903 | const extra_offset = tree.errorOffset(cur_err); | 903 | const extra_offset = tree.errorOffset(cur_err); |
| 904 | try zg.addErrorTokNotesOff(cur_err.token, extra_offset, "{s}", .{msg.getWritten()}, notes.items); | 904 | try zg.addErrorTokNotesOff(cur_err.token, extra_offset, "{s}", .{msg.written()}, notes.items); |
| 905 | notes.clearRetainingCapacity(); | 905 | notes.clearRetainingCapacity(); |
| 906 | cur_err = err; | 906 | cur_err = err; |
| 907 | 907 | ||
| ... | @@ -917,5 +917,5 @@ fn lowerAstErrors(zg: *ZonGen) Allocator.Error!void { | ... | @@ -917,5 +917,5 @@ fn lowerAstErrors(zg: *ZonGen) Allocator.Error!void { |
| 917 | // Flush error | 917 | // Flush error |
| 918 | const extra_offset = tree.errorOffset(cur_err); | 918 | const extra_offset = tree.errorOffset(cur_err); |
| 919 | tree.renderError(cur_err, msg_bw) catch return error.OutOfMemory; | 919 | tree.renderError(cur_err, msg_bw) catch return error.OutOfMemory; |
| 920 | try zg.addErrorTokNotesOff(cur_err.token, extra_offset, "{s}", .{msg.getWritten()}, notes.items); | 920 | try zg.addErrorTokNotesOff(cur_err.token, extra_offset, "{s}", .{msg.written()}, notes.items); |
| 921 | } | 921 | } |
lib/std/zon/stringify.zig+116-116| ... | @@ -125,7 +125,7 @@ fn expectSerializeEqual( | ... | @@ -125,7 +125,7 @@ fn expectSerializeEqual( |
| 125 | defer aw.deinit(); | 125 | defer aw.deinit(); |
| 126 | 126 | ||
| 127 | try serialize(value, options, bw); | 127 | try serialize(value, options, bw); |
| 128 | try std.testing.expectEqualStrings(expected, aw.getWritten()); | 128 | try std.testing.expectEqualStrings(expected, aw.written()); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | test "std.zon stringify whitespace, high level API" { | 131 | test "std.zon stringify whitespace, high level API" { |
| ... | @@ -233,42 +233,42 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -233,42 +233,42 @@ test "std.zon stringify whitespace, low level API" { |
| 233 | { | 233 | { |
| 234 | var container = try s.beginStruct(.{}); | 234 | var container = try s.beginStruct(.{}); |
| 235 | try container.end(); | 235 | try container.end(); |
| 236 | try std.testing.expectEqualStrings(".{}", aw.getWritten()); | 236 | try std.testing.expectEqualStrings(".{}", aw.written()); |
| 237 | aw.clearRetainingCapacity(); | 237 | aw.clearRetainingCapacity(); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | { | 240 | { |
| 241 | var container = try s.beginTuple(.{}); | 241 | var container = try s.beginTuple(.{}); |
| 242 | try container.end(); | 242 | try container.end(); |
| 243 | try std.testing.expectEqualStrings(".{}", aw.getWritten()); | 243 | try std.testing.expectEqualStrings(".{}", aw.written()); |
| 244 | aw.clearRetainingCapacity(); | 244 | aw.clearRetainingCapacity(); |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | { | 247 | { |
| 248 | var container = try s.beginStruct(.{ .whitespace_style = .{ .wrap = false } }); | 248 | var container = try s.beginStruct(.{ .whitespace_style = .{ .wrap = false } }); |
| 249 | try container.end(); | 249 | try container.end(); |
| 250 | try std.testing.expectEqualStrings(".{}", aw.getWritten()); | 250 | try std.testing.expectEqualStrings(".{}", aw.written()); |
| 251 | aw.clearRetainingCapacity(); | 251 | aw.clearRetainingCapacity(); |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | { | 254 | { |
| 255 | var container = try s.beginTuple(.{ .whitespace_style = .{ .wrap = false } }); | 255 | var container = try s.beginTuple(.{ .whitespace_style = .{ .wrap = false } }); |
| 256 | try container.end(); | 256 | try container.end(); |
| 257 | try std.testing.expectEqualStrings(".{}", aw.getWritten()); | 257 | try std.testing.expectEqualStrings(".{}", aw.written()); |
| 258 | aw.clearRetainingCapacity(); | 258 | aw.clearRetainingCapacity(); |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | { | 261 | { |
| 262 | var container = try s.beginStruct(.{ .whitespace_style = .{ .fields = 0 } }); | 262 | var container = try s.beginStruct(.{ .whitespace_style = .{ .fields = 0 } }); |
| 263 | try container.end(); | 263 | try container.end(); |
| 264 | try std.testing.expectEqualStrings(".{}", aw.getWritten()); | 264 | try std.testing.expectEqualStrings(".{}", aw.written()); |
| 265 | aw.clearRetainingCapacity(); | 265 | aw.clearRetainingCapacity(); |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | { | 268 | { |
| 269 | var container = try s.beginTuple(.{ .whitespace_style = .{ .fields = 0 } }); | 269 | var container = try s.beginTuple(.{ .whitespace_style = .{ .fields = 0 } }); |
| 270 | try container.end(); | 270 | try container.end(); |
| 271 | try std.testing.expectEqualStrings(".{}", aw.getWritten()); | 271 | try std.testing.expectEqualStrings(".{}", aw.written()); |
| 272 | aw.clearRetainingCapacity(); | 272 | aw.clearRetainingCapacity(); |
| 273 | } | 273 | } |
| 274 | 274 | ||
| ... | @@ -282,9 +282,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -282,9 +282,9 @@ test "std.zon stringify whitespace, low level API" { |
| 282 | \\.{ | 282 | \\.{ |
| 283 | \\ .a = 1, | 283 | \\ .a = 1, |
| 284 | \\} | 284 | \\} |
| 285 | , aw.getWritten()); | 285 | , aw.written()); |
| 286 | } else { | 286 | } else { |
| 287 | try std.testing.expectEqualStrings(".{.a=1}", aw.getWritten()); | 287 | try std.testing.expectEqualStrings(".{.a=1}", aw.written()); |
| 288 | } | 288 | } |
| 289 | aw.clearRetainingCapacity(); | 289 | aw.clearRetainingCapacity(); |
| 290 | } | 290 | } |
| ... | @@ -298,9 +298,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -298,9 +298,9 @@ test "std.zon stringify whitespace, low level API" { |
| 298 | \\.{ | 298 | \\.{ |
| 299 | \\ 1, | 299 | \\ 1, |
| 300 | \\} | 300 | \\} |
| 301 | , aw.getWritten()); | 301 | , aw.written()); |
| 302 | } else { | 302 | } else { |
| 303 | try std.testing.expectEqualStrings(".{1}", aw.getWritten()); | 303 | try std.testing.expectEqualStrings(".{1}", aw.written()); |
| 304 | } | 304 | } |
| 305 | aw.clearRetainingCapacity(); | 305 | aw.clearRetainingCapacity(); |
| 306 | } | 306 | } |
| ... | @@ -310,9 +310,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -310,9 +310,9 @@ test "std.zon stringify whitespace, low level API" { |
| 310 | try container.field("a", 1, .{}); | 310 | try container.field("a", 1, .{}); |
| 311 | try container.end(); | 311 | try container.end(); |
| 312 | if (whitespace) { | 312 | if (whitespace) { |
| 313 | try std.testing.expectEqualStrings(".{ .a = 1 }", aw.getWritten()); | 313 | try std.testing.expectEqualStrings(".{ .a = 1 }", aw.written()); |
| 314 | } else { | 314 | } else { |
| 315 | try std.testing.expectEqualStrings(".{.a=1}", aw.getWritten()); | 315 | try std.testing.expectEqualStrings(".{.a=1}", aw.written()); |
| 316 | } | 316 | } |
| 317 | aw.clearRetainingCapacity(); | 317 | aw.clearRetainingCapacity(); |
| 318 | } | 318 | } |
| ... | @@ -324,9 +324,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -324,9 +324,9 @@ test "std.zon stringify whitespace, low level API" { |
| 324 | try container.field(1, .{}); | 324 | try container.field(1, .{}); |
| 325 | try container.end(); | 325 | try container.end(); |
| 326 | if (whitespace) { | 326 | if (whitespace) { |
| 327 | try std.testing.expectEqualStrings(".{ 1 }", aw.getWritten()); | 327 | try std.testing.expectEqualStrings(".{ 1 }", aw.written()); |
| 328 | } else { | 328 | } else { |
| 329 | try std.testing.expectEqualStrings(".{1}", aw.getWritten()); | 329 | try std.testing.expectEqualStrings(".{1}", aw.written()); |
| 330 | } | 330 | } |
| 331 | aw.clearRetainingCapacity(); | 331 | aw.clearRetainingCapacity(); |
| 332 | } | 332 | } |
| ... | @@ -336,9 +336,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -336,9 +336,9 @@ test "std.zon stringify whitespace, low level API" { |
| 336 | try container.field("a", 1, .{}); | 336 | try container.field("a", 1, .{}); |
| 337 | try container.end(); | 337 | try container.end(); |
| 338 | if (whitespace) { | 338 | if (whitespace) { |
| 339 | try std.testing.expectEqualStrings(".{ .a = 1 }", aw.getWritten()); | 339 | try std.testing.expectEqualStrings(".{ .a = 1 }", aw.written()); |
| 340 | } else { | 340 | } else { |
| 341 | try std.testing.expectEqualStrings(".{.a=1}", aw.getWritten()); | 341 | try std.testing.expectEqualStrings(".{.a=1}", aw.written()); |
| 342 | } | 342 | } |
| 343 | aw.clearRetainingCapacity(); | 343 | aw.clearRetainingCapacity(); |
| 344 | } | 344 | } |
| ... | @@ -347,7 +347,7 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -347,7 +347,7 @@ test "std.zon stringify whitespace, low level API" { |
| 347 | var container = try s.beginTuple(.{ .whitespace_style = .{ .fields = 1 } }); | 347 | var container = try s.beginTuple(.{ .whitespace_style = .{ .fields = 1 } }); |
| 348 | try container.field(1, .{}); | 348 | try container.field(1, .{}); |
| 349 | try container.end(); | 349 | try container.end(); |
| 350 | try std.testing.expectEqualStrings(".{1}", aw.getWritten()); | 350 | try std.testing.expectEqualStrings(".{1}", aw.written()); |
| 351 | aw.clearRetainingCapacity(); | 351 | aw.clearRetainingCapacity(); |
| 352 | } | 352 | } |
| 353 | 353 | ||
| ... | @@ -363,9 +363,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -363,9 +363,9 @@ test "std.zon stringify whitespace, low level API" { |
| 363 | \\ .a = 1, | 363 | \\ .a = 1, |
| 364 | \\ .b = 2, | 364 | \\ .b = 2, |
| 365 | \\} | 365 | \\} |
| 366 | , aw.getWritten()); | 366 | , aw.written()); |
| 367 | } else { | 367 | } else { |
| 368 | try std.testing.expectEqualStrings(".{.a=1,.b=2}", aw.getWritten()); | 368 | try std.testing.expectEqualStrings(".{.a=1,.b=2}", aw.written()); |
| 369 | } | 369 | } |
| 370 | aw.clearRetainingCapacity(); | 370 | aw.clearRetainingCapacity(); |
| 371 | } | 371 | } |
| ... | @@ -381,9 +381,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -381,9 +381,9 @@ test "std.zon stringify whitespace, low level API" { |
| 381 | \\ 1, | 381 | \\ 1, |
| 382 | \\ 2, | 382 | \\ 2, |
| 383 | \\} | 383 | \\} |
| 384 | , aw.getWritten()); | 384 | , aw.written()); |
| 385 | } else { | 385 | } else { |
| 386 | try std.testing.expectEqualStrings(".{1,2}", aw.getWritten()); | 386 | try std.testing.expectEqualStrings(".{1,2}", aw.written()); |
| 387 | } | 387 | } |
| 388 | aw.clearRetainingCapacity(); | 388 | aw.clearRetainingCapacity(); |
| 389 | } | 389 | } |
| ... | @@ -394,9 +394,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -394,9 +394,9 @@ test "std.zon stringify whitespace, low level API" { |
| 394 | try container.field("b", 2, .{}); | 394 | try container.field("b", 2, .{}); |
| 395 | try container.end(); | 395 | try container.end(); |
| 396 | if (whitespace) { | 396 | if (whitespace) { |
| 397 | try std.testing.expectEqualStrings(".{ .a = 1, .b = 2 }", aw.getWritten()); | 397 | try std.testing.expectEqualStrings(".{ .a = 1, .b = 2 }", aw.written()); |
| 398 | } else { | 398 | } else { |
| 399 | try std.testing.expectEqualStrings(".{.a=1,.b=2}", aw.getWritten()); | 399 | try std.testing.expectEqualStrings(".{.a=1,.b=2}", aw.written()); |
| 400 | } | 400 | } |
| 401 | aw.clearRetainingCapacity(); | 401 | aw.clearRetainingCapacity(); |
| 402 | } | 402 | } |
| ... | @@ -407,9 +407,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -407,9 +407,9 @@ test "std.zon stringify whitespace, low level API" { |
| 407 | try container.field(2, .{}); | 407 | try container.field(2, .{}); |
| 408 | try container.end(); | 408 | try container.end(); |
| 409 | if (whitespace) { | 409 | if (whitespace) { |
| 410 | try std.testing.expectEqualStrings(".{ 1, 2 }", aw.getWritten()); | 410 | try std.testing.expectEqualStrings(".{ 1, 2 }", aw.written()); |
| 411 | } else { | 411 | } else { |
| 412 | try std.testing.expectEqualStrings(".{1,2}", aw.getWritten()); | 412 | try std.testing.expectEqualStrings(".{1,2}", aw.written()); |
| 413 | } | 413 | } |
| 414 | aw.clearRetainingCapacity(); | 414 | aw.clearRetainingCapacity(); |
| 415 | } | 415 | } |
| ... | @@ -420,9 +420,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -420,9 +420,9 @@ test "std.zon stringify whitespace, low level API" { |
| 420 | try container.field("b", 2, .{}); | 420 | try container.field("b", 2, .{}); |
| 421 | try container.end(); | 421 | try container.end(); |
| 422 | if (whitespace) { | 422 | if (whitespace) { |
| 423 | try std.testing.expectEqualStrings(".{ .a = 1, .b = 2 }", aw.getWritten()); | 423 | try std.testing.expectEqualStrings(".{ .a = 1, .b = 2 }", aw.written()); |
| 424 | } else { | 424 | } else { |
| 425 | try std.testing.expectEqualStrings(".{.a=1,.b=2}", aw.getWritten()); | 425 | try std.testing.expectEqualStrings(".{.a=1,.b=2}", aw.written()); |
| 426 | } | 426 | } |
| 427 | aw.clearRetainingCapacity(); | 427 | aw.clearRetainingCapacity(); |
| 428 | } | 428 | } |
| ... | @@ -433,9 +433,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -433,9 +433,9 @@ test "std.zon stringify whitespace, low level API" { |
| 433 | try container.field(2, .{}); | 433 | try container.field(2, .{}); |
| 434 | try container.end(); | 434 | try container.end(); |
| 435 | if (whitespace) { | 435 | if (whitespace) { |
| 436 | try std.testing.expectEqualStrings(".{ 1, 2 }", aw.getWritten()); | 436 | try std.testing.expectEqualStrings(".{ 1, 2 }", aw.written()); |
| 437 | } else { | 437 | } else { |
| 438 | try std.testing.expectEqualStrings(".{1,2}", aw.getWritten()); | 438 | try std.testing.expectEqualStrings(".{1,2}", aw.written()); |
| 439 | } | 439 | } |
| 440 | aw.clearRetainingCapacity(); | 440 | aw.clearRetainingCapacity(); |
| 441 | } | 441 | } |
| ... | @@ -454,9 +454,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -454,9 +454,9 @@ test "std.zon stringify whitespace, low level API" { |
| 454 | \\ .b = 2, | 454 | \\ .b = 2, |
| 455 | \\ .c = 3, | 455 | \\ .c = 3, |
| 456 | \\} | 456 | \\} |
| 457 | , aw.getWritten()); | 457 | , aw.written()); |
| 458 | } else { | 458 | } else { |
| 459 | try std.testing.expectEqualStrings(".{.a=1,.b=2,.c=3}", aw.getWritten()); | 459 | try std.testing.expectEqualStrings(".{.a=1,.b=2,.c=3}", aw.written()); |
| 460 | } | 460 | } |
| 461 | aw.clearRetainingCapacity(); | 461 | aw.clearRetainingCapacity(); |
| 462 | } | 462 | } |
| ... | @@ -474,9 +474,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -474,9 +474,9 @@ test "std.zon stringify whitespace, low level API" { |
| 474 | \\ 2, | 474 | \\ 2, |
| 475 | \\ 3, | 475 | \\ 3, |
| 476 | \\} | 476 | \\} |
| 477 | , aw.getWritten()); | 477 | , aw.written()); |
| 478 | } else { | 478 | } else { |
| 479 | try std.testing.expectEqualStrings(".{1,2,3}", aw.getWritten()); | 479 | try std.testing.expectEqualStrings(".{1,2,3}", aw.written()); |
| 480 | } | 480 | } |
| 481 | aw.clearRetainingCapacity(); | 481 | aw.clearRetainingCapacity(); |
| 482 | } | 482 | } |
| ... | @@ -488,9 +488,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -488,9 +488,9 @@ test "std.zon stringify whitespace, low level API" { |
| 488 | try container.field("c", 3, .{}); | 488 | try container.field("c", 3, .{}); |
| 489 | try container.end(); | 489 | try container.end(); |
| 490 | if (whitespace) { | 490 | if (whitespace) { |
| 491 | try std.testing.expectEqualStrings(".{ .a = 1, .b = 2, .c = 3 }", aw.getWritten()); | 491 | try std.testing.expectEqualStrings(".{ .a = 1, .b = 2, .c = 3 }", aw.written()); |
| 492 | } else { | 492 | } else { |
| 493 | try std.testing.expectEqualStrings(".{.a=1,.b=2,.c=3}", aw.getWritten()); | 493 | try std.testing.expectEqualStrings(".{.a=1,.b=2,.c=3}", aw.written()); |
| 494 | } | 494 | } |
| 495 | aw.clearRetainingCapacity(); | 495 | aw.clearRetainingCapacity(); |
| 496 | } | 496 | } |
| ... | @@ -502,9 +502,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -502,9 +502,9 @@ test "std.zon stringify whitespace, low level API" { |
| 502 | try container.field(3, .{}); | 502 | try container.field(3, .{}); |
| 503 | try container.end(); | 503 | try container.end(); |
| 504 | if (whitespace) { | 504 | if (whitespace) { |
| 505 | try std.testing.expectEqualStrings(".{ 1, 2, 3 }", aw.getWritten()); | 505 | try std.testing.expectEqualStrings(".{ 1, 2, 3 }", aw.written()); |
| 506 | } else { | 506 | } else { |
| 507 | try std.testing.expectEqualStrings(".{1,2,3}", aw.getWritten()); | 507 | try std.testing.expectEqualStrings(".{1,2,3}", aw.written()); |
| 508 | } | 508 | } |
| 509 | aw.clearRetainingCapacity(); | 509 | aw.clearRetainingCapacity(); |
| 510 | } | 510 | } |
| ... | @@ -522,9 +522,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -522,9 +522,9 @@ test "std.zon stringify whitespace, low level API" { |
| 522 | \\ .b = 2, | 522 | \\ .b = 2, |
| 523 | \\ .c = 3, | 523 | \\ .c = 3, |
| 524 | \\} | 524 | \\} |
| 525 | , aw.getWritten()); | 525 | , aw.written()); |
| 526 | } else { | 526 | } else { |
| 527 | try std.testing.expectEqualStrings(".{.a=1,.b=2,.c=3}", aw.getWritten()); | 527 | try std.testing.expectEqualStrings(".{.a=1,.b=2,.c=3}", aw.written()); |
| 528 | } | 528 | } |
| 529 | aw.clearRetainingCapacity(); | 529 | aw.clearRetainingCapacity(); |
| 530 | } | 530 | } |
| ... | @@ -542,9 +542,9 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -542,9 +542,9 @@ test "std.zon stringify whitespace, low level API" { |
| 542 | \\ 2, | 542 | \\ 2, |
| 543 | \\ 3, | 543 | \\ 3, |
| 544 | \\} | 544 | \\} |
| 545 | , aw.getWritten()); | 545 | , aw.written()); |
| 546 | } else { | 546 | } else { |
| 547 | try std.testing.expectEqualStrings(".{1,2,3}", aw.getWritten()); | 547 | try std.testing.expectEqualStrings(".{1,2,3}", aw.written()); |
| 548 | } | 548 | } |
| 549 | aw.clearRetainingCapacity(); | 549 | aw.clearRetainingCapacity(); |
| 550 | } | 550 | } |
| ... | @@ -566,11 +566,11 @@ test "std.zon stringify whitespace, low level API" { | ... | @@ -566,11 +566,11 @@ test "std.zon stringify whitespace, low level API" { |
| 566 | \\ 5, | 566 | \\ 5, |
| 567 | \\ 6, | 567 | \\ 6, |
| 568 | \\} } | 568 | \\} } |
| 569 | , aw.getWritten()); | 569 | , aw.written()); |
| 570 | } else { | 570 | } else { |
| 571 | try std.testing.expectEqualStrings( | 571 | try std.testing.expectEqualStrings( |
| 572 | ".{.first=.{1,2,3},.second=.{4,5,6}}", | 572 | ".{.first=.{1,2,3},.second=.{4,5,6}}", |
| 573 | aw.getWritten(), | 573 | aw.written(), |
| 574 | ); | 574 | ); |
| 575 | } | 575 | } |
| 576 | aw.clearRetainingCapacity(); | 576 | aw.clearRetainingCapacity(); |
| ... | @@ -585,108 +585,108 @@ test "std.zon stringify utf8 codepoints" { | ... | @@ -585,108 +585,108 @@ test "std.zon stringify utf8 codepoints" { |
| 585 | 585 | ||
| 586 | // Printable ASCII | 586 | // Printable ASCII |
| 587 | try s.int('a'); | 587 | try s.int('a'); |
| 588 | try std.testing.expectEqualStrings("97", aw.getWritten()); | 588 | try std.testing.expectEqualStrings("97", aw.written()); |
| 589 | aw.clearRetainingCapacity(); | 589 | aw.clearRetainingCapacity(); |
| 590 | 590 | ||
| 591 | try s.codePoint('a'); | 591 | try s.codePoint('a'); |
| 592 | try std.testing.expectEqualStrings("'a'", aw.getWritten()); | 592 | try std.testing.expectEqualStrings("'a'", aw.written()); |
| 593 | aw.clearRetainingCapacity(); | 593 | aw.clearRetainingCapacity(); |
| 594 | 594 | ||
| 595 | try s.value('a', .{ .emit_codepoint_literals = .always }); | 595 | try s.value('a', .{ .emit_codepoint_literals = .always }); |
| 596 | try std.testing.expectEqualStrings("'a'", aw.getWritten()); | 596 | try std.testing.expectEqualStrings("'a'", aw.written()); |
| 597 | aw.clearRetainingCapacity(); | 597 | aw.clearRetainingCapacity(); |
| 598 | 598 | ||
| 599 | try s.value('a', .{ .emit_codepoint_literals = .printable_ascii }); | 599 | try s.value('a', .{ .emit_codepoint_literals = .printable_ascii }); |
| 600 | try std.testing.expectEqualStrings("'a'", aw.getWritten()); | 600 | try std.testing.expectEqualStrings("'a'", aw.written()); |
| 601 | aw.clearRetainingCapacity(); | 601 | aw.clearRetainingCapacity(); |
| 602 | 602 | ||
| 603 | try s.value('a', .{ .emit_codepoint_literals = .never }); | 603 | try s.value('a', .{ .emit_codepoint_literals = .never }); |
| 604 | try std.testing.expectEqualStrings("97", aw.getWritten()); | 604 | try std.testing.expectEqualStrings("97", aw.written()); |
| 605 | aw.clearRetainingCapacity(); | 605 | aw.clearRetainingCapacity(); |
| 606 | 606 | ||
| 607 | // Short escaped codepoint | 607 | // Short escaped codepoint |
| 608 | try s.int('\n'); | 608 | try s.int('\n'); |
| 609 | try std.testing.expectEqualStrings("10", aw.getWritten()); | 609 | try std.testing.expectEqualStrings("10", aw.written()); |
| 610 | aw.clearRetainingCapacity(); | 610 | aw.clearRetainingCapacity(); |
| 611 | 611 | ||
| 612 | try s.codePoint('\n'); | 612 | try s.codePoint('\n'); |
| 613 | try std.testing.expectEqualStrings("'\\n'", aw.getWritten()); | 613 | try std.testing.expectEqualStrings("'\\n'", aw.written()); |
| 614 | aw.clearRetainingCapacity(); | 614 | aw.clearRetainingCapacity(); |
| 615 | 615 | ||
| 616 | try s.value('\n', .{ .emit_codepoint_literals = .always }); | 616 | try s.value('\n', .{ .emit_codepoint_literals = .always }); |
| 617 | try std.testing.expectEqualStrings("'\\n'", aw.getWritten()); | 617 | try std.testing.expectEqualStrings("'\\n'", aw.written()); |
| 618 | aw.clearRetainingCapacity(); | 618 | aw.clearRetainingCapacity(); |
| 619 | 619 | ||
| 620 | try s.value('\n', .{ .emit_codepoint_literals = .printable_ascii }); | 620 | try s.value('\n', .{ .emit_codepoint_literals = .printable_ascii }); |
| 621 | try std.testing.expectEqualStrings("10", aw.getWritten()); | 621 | try std.testing.expectEqualStrings("10", aw.written()); |
| 622 | aw.clearRetainingCapacity(); | 622 | aw.clearRetainingCapacity(); |
| 623 | 623 | ||
| 624 | try s.value('\n', .{ .emit_codepoint_literals = .never }); | 624 | try s.value('\n', .{ .emit_codepoint_literals = .never }); |
| 625 | try std.testing.expectEqualStrings("10", aw.getWritten()); | 625 | try std.testing.expectEqualStrings("10", aw.written()); |
| 626 | aw.clearRetainingCapacity(); | 626 | aw.clearRetainingCapacity(); |
| 627 | 627 | ||
| 628 | // Large codepoint | 628 | // Large codepoint |
| 629 | try s.int('âš¡'); | 629 | try s.int('âš¡'); |
| 630 | try std.testing.expectEqualStrings("9889", aw.getWritten()); | 630 | try std.testing.expectEqualStrings("9889", aw.written()); |
| 631 | aw.clearRetainingCapacity(); | 631 | aw.clearRetainingCapacity(); |
| 632 | 632 | ||
| 633 | try s.codePoint('âš¡'); | 633 | try s.codePoint('âš¡'); |
| 634 | try std.testing.expectEqualStrings("'\\u{26a1}'", aw.getWritten()); | 634 | try std.testing.expectEqualStrings("'\\u{26a1}'", aw.written()); |
| 635 | aw.clearRetainingCapacity(); | 635 | aw.clearRetainingCapacity(); |
| 636 | 636 | ||
| 637 | try s.value('âš¡', .{ .emit_codepoint_literals = .always }); | 637 | try s.value('âš¡', .{ .emit_codepoint_literals = .always }); |
| 638 | try std.testing.expectEqualStrings("'\\u{26a1}'", aw.getWritten()); | 638 | try std.testing.expectEqualStrings("'\\u{26a1}'", aw.written()); |
| 639 | aw.clearRetainingCapacity(); | 639 | aw.clearRetainingCapacity(); |
| 640 | 640 | ||
| 641 | try s.value('âš¡', .{ .emit_codepoint_literals = .printable_ascii }); | 641 | try s.value('âš¡', .{ .emit_codepoint_literals = .printable_ascii }); |
| 642 | try std.testing.expectEqualStrings("9889", aw.getWritten()); | 642 | try std.testing.expectEqualStrings("9889", aw.written()); |
| 643 | aw.clearRetainingCapacity(); | 643 | aw.clearRetainingCapacity(); |
| 644 | 644 | ||
| 645 | try s.value('âš¡', .{ .emit_codepoint_literals = .never }); | 645 | try s.value('âš¡', .{ .emit_codepoint_literals = .never }); |
| 646 | try std.testing.expectEqualStrings("9889", aw.getWritten()); | 646 | try std.testing.expectEqualStrings("9889", aw.written()); |
| 647 | aw.clearRetainingCapacity(); | 647 | aw.clearRetainingCapacity(); |
| 648 | 648 | ||
| 649 | // Invalid codepoint | 649 | // Invalid codepoint |
| 650 | try s.codePoint(0x110000 + 1); | 650 | try s.codePoint(0x110000 + 1); |
| 651 | try std.testing.expectEqualStrings("'\\u{110001}'", aw.getWritten()); | 651 | try std.testing.expectEqualStrings("'\\u{110001}'", aw.written()); |
| 652 | aw.clearRetainingCapacity(); | 652 | aw.clearRetainingCapacity(); |
| 653 | 653 | ||
| 654 | try s.int(0x110000 + 1); | 654 | try s.int(0x110000 + 1); |
| 655 | try std.testing.expectEqualStrings("1114113", aw.getWritten()); | 655 | try std.testing.expectEqualStrings("1114113", aw.written()); |
| 656 | aw.clearRetainingCapacity(); | 656 | aw.clearRetainingCapacity(); |
| 657 | 657 | ||
| 658 | try s.value(0x110000 + 1, .{ .emit_codepoint_literals = .always }); | 658 | try s.value(0x110000 + 1, .{ .emit_codepoint_literals = .always }); |
| 659 | try std.testing.expectEqualStrings("1114113", aw.getWritten()); | 659 | try std.testing.expectEqualStrings("1114113", aw.written()); |
| 660 | aw.clearRetainingCapacity(); | 660 | aw.clearRetainingCapacity(); |
| 661 | 661 | ||
| 662 | try s.value(0x110000 + 1, .{ .emit_codepoint_literals = .printable_ascii }); | 662 | try s.value(0x110000 + 1, .{ .emit_codepoint_literals = .printable_ascii }); |
| 663 | try std.testing.expectEqualStrings("1114113", aw.getWritten()); | 663 | try std.testing.expectEqualStrings("1114113", aw.written()); |
| 664 | aw.clearRetainingCapacity(); | 664 | aw.clearRetainingCapacity(); |
| 665 | 665 | ||
| 666 | try s.value(0x110000 + 1, .{ .emit_codepoint_literals = .never }); | 666 | try s.value(0x110000 + 1, .{ .emit_codepoint_literals = .never }); |
| 667 | try std.testing.expectEqualStrings("1114113", aw.getWritten()); | 667 | try std.testing.expectEqualStrings("1114113", aw.written()); |
| 668 | aw.clearRetainingCapacity(); | 668 | aw.clearRetainingCapacity(); |
| 669 | 669 | ||
| 670 | // Valid codepoint, not a codepoint type | 670 | // Valid codepoint, not a codepoint type |
| 671 | try s.value(@as(u22, 'a'), .{ .emit_codepoint_literals = .always }); | 671 | try s.value(@as(u22, 'a'), .{ .emit_codepoint_literals = .always }); |
| 672 | try std.testing.expectEqualStrings("97", aw.getWritten()); | 672 | try std.testing.expectEqualStrings("97", aw.written()); |
| 673 | aw.clearRetainingCapacity(); | 673 | aw.clearRetainingCapacity(); |
| 674 | 674 | ||
| 675 | try s.value(@as(u22, 'a'), .{ .emit_codepoint_literals = .printable_ascii }); | 675 | try s.value(@as(u22, 'a'), .{ .emit_codepoint_literals = .printable_ascii }); |
| 676 | try std.testing.expectEqualStrings("97", aw.getWritten()); | 676 | try std.testing.expectEqualStrings("97", aw.written()); |
| 677 | aw.clearRetainingCapacity(); | 677 | aw.clearRetainingCapacity(); |
| 678 | 678 | ||
| 679 | try s.value(@as(i32, 'a'), .{ .emit_codepoint_literals = .never }); | 679 | try s.value(@as(i32, 'a'), .{ .emit_codepoint_literals = .never }); |
| 680 | try std.testing.expectEqualStrings("97", aw.getWritten()); | 680 | try std.testing.expectEqualStrings("97", aw.written()); |
| 681 | aw.clearRetainingCapacity(); | 681 | aw.clearRetainingCapacity(); |
| 682 | 682 | ||
| 683 | // Make sure value options are passed to children | 683 | // Make sure value options are passed to children |
| 684 | try s.value(.{ .c = 'âš¡' }, .{ .emit_codepoint_literals = .always }); | 684 | try s.value(.{ .c = 'âš¡' }, .{ .emit_codepoint_literals = .always }); |
| 685 | try std.testing.expectEqualStrings(".{ .c = '\\u{26a1}' }", aw.getWritten()); | 685 | try std.testing.expectEqualStrings(".{ .c = '\\u{26a1}' }", aw.written()); |
| 686 | aw.clearRetainingCapacity(); | 686 | aw.clearRetainingCapacity(); |
| 687 | 687 | ||
| 688 | try s.value(.{ .c = 'âš¡' }, .{ .emit_codepoint_literals = .never }); | 688 | try s.value(.{ .c = 'âš¡' }, .{ .emit_codepoint_literals = .never }); |
| 689 | try std.testing.expectEqualStrings(".{ .c = 9889 }", aw.getWritten()); | 689 | try std.testing.expectEqualStrings(".{ .c = 9889 }", aw.written()); |
| 690 | aw.clearRetainingCapacity(); | 690 | aw.clearRetainingCapacity(); |
| 691 | } | 691 | } |
| 692 | 692 | ||
| ... | @@ -697,7 +697,7 @@ test "std.zon stringify strings" { | ... | @@ -697,7 +697,7 @@ test "std.zon stringify strings" { |
| 697 | 697 | ||
| 698 | // Minimal case | 698 | // Minimal case |
| 699 | try s.string("abcâš¡\n"); | 699 | try s.string("abcâš¡\n"); |
| 700 | try std.testing.expectEqualStrings("\"abc\\xe2\\x9a\\xa1\\n\"", aw.getWritten()); | 700 | try std.testing.expectEqualStrings("\"abc\\xe2\\x9a\\xa1\\n\"", aw.written()); |
| 701 | aw.clearRetainingCapacity(); | 701 | aw.clearRetainingCapacity(); |
| 702 | 702 | ||
| 703 | try s.tuple("abcâš¡\n", .{}); | 703 | try s.tuple("abcâš¡\n", .{}); |
| ... | @@ -711,11 +711,11 @@ test "std.zon stringify strings" { | ... | @@ -711,11 +711,11 @@ test "std.zon stringify strings" { |
| 711 | \\ 161, | 711 | \\ 161, |
| 712 | \\ 10, | 712 | \\ 10, |
| 713 | \\} | 713 | \\} |
| 714 | , aw.getWritten()); | 714 | , aw.written()); |
| 715 | aw.clearRetainingCapacity(); | 715 | aw.clearRetainingCapacity(); |
| 716 | 716 | ||
| 717 | try s.value("abcâš¡\n", .{}); | 717 | try s.value("abcâš¡\n", .{}); |
| 718 | try std.testing.expectEqualStrings("\"abc\\xe2\\x9a\\xa1\\n\"", aw.getWritten()); | 718 | try std.testing.expectEqualStrings("\"abc\\xe2\\x9a\\xa1\\n\"", aw.written()); |
| 719 | aw.clearRetainingCapacity(); | 719 | aw.clearRetainingCapacity(); |
| 720 | 720 | ||
| 721 | try s.value("abcâš¡\n", .{ .emit_strings_as_containers = true }); | 721 | try s.value("abcâš¡\n", .{ .emit_strings_as_containers = true }); |
| ... | @@ -729,12 +729,12 @@ test "std.zon stringify strings" { | ... | @@ -729,12 +729,12 @@ test "std.zon stringify strings" { |
| 729 | \\ 161, | 729 | \\ 161, |
| 730 | \\ 10, | 730 | \\ 10, |
| 731 | \\} | 731 | \\} |
| 732 | , aw.getWritten()); | 732 | , aw.written()); |
| 733 | aw.clearRetainingCapacity(); | 733 | aw.clearRetainingCapacity(); |
| 734 | 734 | ||
| 735 | // Value options are inherited by children | 735 | // Value options are inherited by children |
| 736 | try s.value(.{ .str = "abc" }, .{}); | 736 | try s.value(.{ .str = "abc" }, .{}); |
| 737 | try std.testing.expectEqualStrings(".{ .str = \"abc\" }", aw.getWritten()); | 737 | try std.testing.expectEqualStrings(".{ .str = \"abc\" }", aw.written()); |
| 738 | aw.clearRetainingCapacity(); | 738 | aw.clearRetainingCapacity(); |
| 739 | 739 | ||
| 740 | try s.value(.{ .str = "abc" }, .{ .emit_strings_as_containers = true }); | 740 | try s.value(.{ .str = "abc" }, .{ .emit_strings_as_containers = true }); |
| ... | @@ -744,7 +744,7 @@ test "std.zon stringify strings" { | ... | @@ -744,7 +744,7 @@ test "std.zon stringify strings" { |
| 744 | \\ 98, | 744 | \\ 98, |
| 745 | \\ 99, | 745 | \\ 99, |
| 746 | \\} } | 746 | \\} } |
| 747 | , aw.getWritten()); | 747 | , aw.written()); |
| 748 | aw.clearRetainingCapacity(); | 748 | aw.clearRetainingCapacity(); |
| 749 | 749 | ||
| 750 | // Arrays (rather than pointers to arrays) of u8s are not considered strings, so that data can | 750 | // Arrays (rather than pointers to arrays) of u8s are not considered strings, so that data can |
| ... | @@ -756,7 +756,7 @@ test "std.zon stringify strings" { | ... | @@ -756,7 +756,7 @@ test "std.zon stringify strings" { |
| 756 | \\ 98, | 756 | \\ 98, |
| 757 | \\ 99, | 757 | \\ 99, |
| 758 | \\} | 758 | \\} |
| 759 | , aw.getWritten()); | 759 | , aw.written()); |
| 760 | aw.clearRetainingCapacity(); | 760 | aw.clearRetainingCapacity(); |
| 761 | } | 761 | } |
| 762 | 762 | ||
| ... | @@ -770,46 +770,46 @@ test "std.zon stringify multiline strings" { | ... | @@ -770,46 +770,46 @@ test "std.zon stringify multiline strings" { |
| 770 | 770 | ||
| 771 | { | 771 | { |
| 772 | try s.multilineString("", .{ .top_level = true }); | 772 | try s.multilineString("", .{ .top_level = true }); |
| 773 | try std.testing.expectEqualStrings("\\\\", aw.getWritten()); | 773 | try std.testing.expectEqualStrings("\\\\", aw.written()); |
| 774 | aw.clearRetainingCapacity(); | 774 | aw.clearRetainingCapacity(); |
| 775 | } | 775 | } |
| 776 | 776 | ||
| 777 | { | 777 | { |
| 778 | try s.multilineString("abcâš¡", .{ .top_level = true }); | 778 | try s.multilineString("abcâš¡", .{ .top_level = true }); |
| 779 | try std.testing.expectEqualStrings("\\\\abcâš¡", aw.getWritten()); | 779 | try std.testing.expectEqualStrings("\\\\abcâš¡", aw.written()); |
| 780 | aw.clearRetainingCapacity(); | 780 | aw.clearRetainingCapacity(); |
| 781 | } | 781 | } |
| 782 | 782 | ||
| 783 | { | 783 | { |
| 784 | try s.multilineString("abcâš¡\ndef", .{ .top_level = true }); | 784 | try s.multilineString("abcâš¡\ndef", .{ .top_level = true }); |
| 785 | try std.testing.expectEqualStrings("\\\\abcâš¡\n\\\\def", aw.getWritten()); | 785 | try std.testing.expectEqualStrings("\\\\abcâš¡\n\\\\def", aw.written()); |
| 786 | aw.clearRetainingCapacity(); | 786 | aw.clearRetainingCapacity(); |
| 787 | } | 787 | } |
| 788 | 788 | ||
| 789 | { | 789 | { |
| 790 | try s.multilineString("abcâš¡\r\ndef", .{ .top_level = true }); | 790 | try s.multilineString("abcâš¡\r\ndef", .{ .top_level = true }); |
| 791 | try std.testing.expectEqualStrings("\\\\abcâš¡\n\\\\def", aw.getWritten()); | 791 | try std.testing.expectEqualStrings("\\\\abcâš¡\n\\\\def", aw.written()); |
| 792 | aw.clearRetainingCapacity(); | 792 | aw.clearRetainingCapacity(); |
| 793 | } | 793 | } |
| 794 | 794 | ||
| 795 | { | 795 | { |
| 796 | try s.multilineString("\nabcâš¡", .{ .top_level = true }); | 796 | try s.multilineString("\nabcâš¡", .{ .top_level = true }); |
| 797 | try std.testing.expectEqualStrings("\\\\\n\\\\abcâš¡", aw.getWritten()); | 797 | try std.testing.expectEqualStrings("\\\\\n\\\\abcâš¡", aw.written()); |
| 798 | aw.clearRetainingCapacity(); | 798 | aw.clearRetainingCapacity(); |
| 799 | } | 799 | } |
| 800 | 800 | ||
| 801 | { | 801 | { |
| 802 | try s.multilineString("\r\nabcâš¡", .{ .top_level = true }); | 802 | try s.multilineString("\r\nabcâš¡", .{ .top_level = true }); |
| 803 | try std.testing.expectEqualStrings("\\\\\n\\\\abcâš¡", aw.getWritten()); | 803 | try std.testing.expectEqualStrings("\\\\\n\\\\abcâš¡", aw.written()); |
| 804 | aw.clearRetainingCapacity(); | 804 | aw.clearRetainingCapacity(); |
| 805 | } | 805 | } |
| 806 | 806 | ||
| 807 | { | 807 | { |
| 808 | try s.multilineString("abc\ndef", .{}); | 808 | try s.multilineString("abc\ndef", .{}); |
| 809 | if (whitespace) { | 809 | if (whitespace) { |
| 810 | try std.testing.expectEqualStrings("\n\\\\abc\n\\\\def\n", aw.getWritten()); | 810 | try std.testing.expectEqualStrings("\n\\\\abc\n\\\\def\n", aw.written()); |
| 811 | } else { | 811 | } else { |
| 812 | try std.testing.expectEqualStrings("\\\\abc\n\\\\def\n", aw.getWritten()); | 812 | try std.testing.expectEqualStrings("\\\\abc\n\\\\def\n", aw.written()); |
| 813 | } | 813 | } |
| 814 | aw.clearRetainingCapacity(); | 814 | aw.clearRetainingCapacity(); |
| 815 | } | 815 | } |
| ... | @@ -817,7 +817,7 @@ test "std.zon stringify multiline strings" { | ... | @@ -817,7 +817,7 @@ test "std.zon stringify multiline strings" { |
| 817 | { | 817 | { |
| 818 | const str: []const u8 = &.{ 'a', '\r', 'c' }; | 818 | const str: []const u8 = &.{ 'a', '\r', 'c' }; |
| 819 | try s.string(str); | 819 | try s.string(str); |
| 820 | try std.testing.expectEqualStrings("\"a\\rc\"", aw.getWritten()); | 820 | try std.testing.expectEqualStrings("\"a\\rc\"", aw.written()); |
| 821 | aw.clearRetainingCapacity(); | 821 | aw.clearRetainingCapacity(); |
| 822 | } | 822 | } |
| 823 | 823 | ||
| ... | @@ -834,7 +834,7 @@ test "std.zon stringify multiline strings" { | ... | @@ -834,7 +834,7 @@ test "std.zon stringify multiline strings" { |
| 834 | error.InnerCarriageReturn, | 834 | error.InnerCarriageReturn, |
| 835 | s.multilineString(@as([]const u8, &.{ 'a', '\r', 'c', '\r', '\n' }), .{}), | 835 | s.multilineString(@as([]const u8, &.{ 'a', '\r', 'c', '\r', '\n' }), .{}), |
| 836 | ); | 836 | ); |
| 837 | try std.testing.expectEqualStrings("", aw.getWritten()); | 837 | try std.testing.expectEqualStrings("", aw.written()); |
| 838 | aw.clearRetainingCapacity(); | 838 | aw.clearRetainingCapacity(); |
| 839 | } | 839 | } |
| 840 | } | 840 | } |
| ... | @@ -989,11 +989,11 @@ test "std.zon depth limits" { | ... | @@ -989,11 +989,11 @@ test "std.zon depth limits" { |
| 989 | 989 | ||
| 990 | // Normal operation | 990 | // Normal operation |
| 991 | try serializeMaxDepth(.{ 1, .{ 2, 3 } }, .{}, bw, 16); | 991 | try serializeMaxDepth(.{ 1, .{ 2, 3 } }, .{}, bw, 16); |
| 992 | try std.testing.expectEqualStrings(".{ 1, .{ 2, 3 } }", aw.getWritten()); | 992 | try std.testing.expectEqualStrings(".{ 1, .{ 2, 3 } }", aw.written()); |
| 993 | aw.clearRetainingCapacity(); | 993 | aw.clearRetainingCapacity(); |
| 994 | 994 | ||
| 995 | try serializeArbitraryDepth(.{ 1, .{ 2, 3 } }, .{}, bw); | 995 | try serializeArbitraryDepth(.{ 1, .{ 2, 3 } }, .{}, bw); |
| 996 | try std.testing.expectEqualStrings(".{ 1, .{ 2, 3 } }", aw.getWritten()); | 996 | try std.testing.expectEqualStrings(".{ 1, .{ 2, 3 } }", aw.written()); |
| 997 | aw.clearRetainingCapacity(); | 997 | aw.clearRetainingCapacity(); |
| 998 | 998 | ||
| 999 | // Max depth failing on non recursive type | 999 | // Max depth failing on non recursive type |
| ... | @@ -1001,14 +1001,14 @@ test "std.zon depth limits" { | ... | @@ -1001,14 +1001,14 @@ test "std.zon depth limits" { |
| 1001 | error.ExceededMaxDepth, | 1001 | error.ExceededMaxDepth, |
| 1002 | serializeMaxDepth(.{ 1, .{ 2, .{ 3, 4 } } }, .{}, bw, 3), | 1002 | serializeMaxDepth(.{ 1, .{ 2, .{ 3, 4 } } }, .{}, bw, 3), |
| 1003 | ); | 1003 | ); |
| 1004 | try std.testing.expectEqualStrings("", aw.getWritten()); | 1004 | try std.testing.expectEqualStrings("", aw.written()); |
| 1005 | aw.clearRetainingCapacity(); | 1005 | aw.clearRetainingCapacity(); |
| 1006 | 1006 | ||
| 1007 | // Max depth passing on recursive type | 1007 | // Max depth passing on recursive type |
| 1008 | { | 1008 | { |
| 1009 | const maybe_recurse = Recurse{ .r = &.{} }; | 1009 | const maybe_recurse = Recurse{ .r = &.{} }; |
| 1010 | try serializeMaxDepth(maybe_recurse, .{}, bw, 2); | 1010 | try serializeMaxDepth(maybe_recurse, .{}, bw, 2); |
| 1011 | try std.testing.expectEqualStrings(".{ .r = .{} }", aw.getWritten()); | 1011 | try std.testing.expectEqualStrings(".{ .r = .{} }", aw.written()); |
| 1012 | aw.clearRetainingCapacity(); | 1012 | aw.clearRetainingCapacity(); |
| 1013 | } | 1013 | } |
| 1014 | 1014 | ||
| ... | @@ -1016,7 +1016,7 @@ test "std.zon depth limits" { | ... | @@ -1016,7 +1016,7 @@ test "std.zon depth limits" { |
| 1016 | { | 1016 | { |
| 1017 | const maybe_recurse = Recurse{ .r = &.{} }; | 1017 | const maybe_recurse = Recurse{ .r = &.{} }; |
| 1018 | try serializeArbitraryDepth(maybe_recurse, .{}, bw); | 1018 | try serializeArbitraryDepth(maybe_recurse, .{}, bw); |
| 1019 | try std.testing.expectEqualStrings(".{ .r = .{} }", aw.getWritten()); | 1019 | try std.testing.expectEqualStrings(".{ .r = .{} }", aw.written()); |
| 1020 | aw.clearRetainingCapacity(); | 1020 | aw.clearRetainingCapacity(); |
| 1021 | } | 1021 | } |
| 1022 | 1022 | ||
| ... | @@ -1028,7 +1028,7 @@ test "std.zon depth limits" { | ... | @@ -1028,7 +1028,7 @@ test "std.zon depth limits" { |
| 1028 | error.ExceededMaxDepth, | 1028 | error.ExceededMaxDepth, |
| 1029 | serializeMaxDepth(maybe_recurse, .{}, bw, 2), | 1029 | serializeMaxDepth(maybe_recurse, .{}, bw, 2), |
| 1030 | ); | 1030 | ); |
| 1031 | try std.testing.expectEqualStrings("", aw.getWritten()); | 1031 | try std.testing.expectEqualStrings("", aw.written()); |
| 1032 | aw.clearRetainingCapacity(); | 1032 | aw.clearRetainingCapacity(); |
| 1033 | } | 1033 | } |
| 1034 | 1034 | ||
| ... | @@ -1041,7 +1041,7 @@ test "std.zon depth limits" { | ... | @@ -1041,7 +1041,7 @@ test "std.zon depth limits" { |
| 1041 | error.ExceededMaxDepth, | 1041 | error.ExceededMaxDepth, |
| 1042 | serializeMaxDepth(maybe_recurse, .{}, bw, 2), | 1042 | serializeMaxDepth(maybe_recurse, .{}, bw, 2), |
| 1043 | ); | 1043 | ); |
| 1044 | try std.testing.expectEqualStrings("", aw.getWritten()); | 1044 | try std.testing.expectEqualStrings("", aw.written()); |
| 1045 | aw.clearRetainingCapacity(); | 1045 | aw.clearRetainingCapacity(); |
| 1046 | 1046 | ||
| 1047 | var s: Serializer = .{ .writer = bw }; | 1047 | var s: Serializer = .{ .writer = bw }; |
| ... | @@ -1050,11 +1050,11 @@ test "std.zon depth limits" { | ... | @@ -1050,11 +1050,11 @@ test "std.zon depth limits" { |
| 1050 | error.ExceededMaxDepth, | 1050 | error.ExceededMaxDepth, |
| 1051 | s.tupleMaxDepth(maybe_recurse, .{}, 2), | 1051 | s.tupleMaxDepth(maybe_recurse, .{}, 2), |
| 1052 | ); | 1052 | ); |
| 1053 | try std.testing.expectEqualStrings("", aw.getWritten()); | 1053 | try std.testing.expectEqualStrings("", aw.written()); |
| 1054 | aw.clearRetainingCapacity(); | 1054 | aw.clearRetainingCapacity(); |
| 1055 | 1055 | ||
| 1056 | try s.tupleArbitraryDepth(maybe_recurse, .{}); | 1056 | try s.tupleArbitraryDepth(maybe_recurse, .{}); |
| 1057 | try std.testing.expectEqualStrings(".{.{ .r = .{} }}", aw.getWritten()); | 1057 | try std.testing.expectEqualStrings(".{.{ .r = .{} }}", aw.written()); |
| 1058 | aw.clearRetainingCapacity(); | 1058 | aw.clearRetainingCapacity(); |
| 1059 | } | 1059 | } |
| 1060 | 1060 | ||
| ... | @@ -1064,17 +1064,17 @@ test "std.zon depth limits" { | ... | @@ -1064,17 +1064,17 @@ test "std.zon depth limits" { |
| 1064 | const maybe_recurse: []const Recurse = &temp; | 1064 | const maybe_recurse: []const Recurse = &temp; |
| 1065 | 1065 | ||
| 1066 | try serializeMaxDepth(maybe_recurse, .{}, bw, 3); | 1066 | try serializeMaxDepth(maybe_recurse, .{}, bw, 3); |
| 1067 | try std.testing.expectEqualStrings(".{.{ .r = .{} }}", aw.getWritten()); | 1067 | try std.testing.expectEqualStrings(".{.{ .r = .{} }}", aw.written()); |
| 1068 | aw.clearRetainingCapacity(); | 1068 | aw.clearRetainingCapacity(); |
| 1069 | 1069 | ||
| 1070 | var s: Serializer = .{ .writer = bw }; | 1070 | var s: Serializer = .{ .writer = bw }; |
| 1071 | 1071 | ||
| 1072 | try s.tupleMaxDepth(maybe_recurse, .{}, 3); | 1072 | try s.tupleMaxDepth(maybe_recurse, .{}, 3); |
| 1073 | try std.testing.expectEqualStrings(".{.{ .r = .{} }}", aw.getWritten()); | 1073 | try std.testing.expectEqualStrings(".{.{ .r = .{} }}", aw.written()); |
| 1074 | aw.clearRetainingCapacity(); | 1074 | aw.clearRetainingCapacity(); |
| 1075 | 1075 | ||
| 1076 | try s.tupleArbitraryDepth(maybe_recurse, .{}); | 1076 | try s.tupleArbitraryDepth(maybe_recurse, .{}); |
| 1077 | try std.testing.expectEqualStrings(".{.{ .r = .{} }}", aw.getWritten()); | 1077 | try std.testing.expectEqualStrings(".{.{ .r = .{} }}", aw.written()); |
| 1078 | aw.clearRetainingCapacity(); | 1078 | aw.clearRetainingCapacity(); |
| 1079 | } | 1079 | } |
| 1080 | 1080 | ||
| ... | @@ -1088,7 +1088,7 @@ test "std.zon depth limits" { | ... | @@ -1088,7 +1088,7 @@ test "std.zon depth limits" { |
| 1088 | error.ExceededMaxDepth, | 1088 | error.ExceededMaxDepth, |
| 1089 | serializeMaxDepth(maybe_recurse, .{}, bw, 128), | 1089 | serializeMaxDepth(maybe_recurse, .{}, bw, 128), |
| 1090 | ); | 1090 | ); |
| 1091 | try std.testing.expectEqualStrings("", aw.getWritten()); | 1091 | try std.testing.expectEqualStrings("", aw.written()); |
| 1092 | aw.clearRetainingCapacity(); | 1092 | aw.clearRetainingCapacity(); |
| 1093 | 1093 | ||
| 1094 | var s: Serializer = .{ .writer = bw }; | 1094 | var s: Serializer = .{ .writer = bw }; |
| ... | @@ -1096,7 +1096,7 @@ test "std.zon depth limits" { | ... | @@ -1096,7 +1096,7 @@ test "std.zon depth limits" { |
| 1096 | error.ExceededMaxDepth, | 1096 | error.ExceededMaxDepth, |
| 1097 | s.tupleMaxDepth(maybe_recurse, .{}, 128), | 1097 | s.tupleMaxDepth(maybe_recurse, .{}, 128), |
| 1098 | ); | 1098 | ); |
| 1099 | try std.testing.expectEqualStrings("", aw.getWritten()); | 1099 | try std.testing.expectEqualStrings("", aw.written()); |
| 1100 | aw.clearRetainingCapacity(); | 1100 | aw.clearRetainingCapacity(); |
| 1101 | } | 1101 | } |
| 1102 | 1102 | ||
| ... | @@ -1146,7 +1146,7 @@ test "std.zon depth limits" { | ... | @@ -1146,7 +1146,7 @@ test "std.zon depth limits" { |
| 1146 | \\ 9, | 1146 | \\ 9, |
| 1147 | \\ .{}, | 1147 | \\ .{}, |
| 1148 | \\} | 1148 | \\} |
| 1149 | , aw.getWritten()); | 1149 | , aw.written()); |
| 1150 | } | 1150 | } |
| 1151 | } | 1151 | } |
| 1152 | 1152 | ||
| ... | @@ -1248,35 +1248,35 @@ test "std.zon stringify ident" { | ... | @@ -1248,35 +1248,35 @@ test "std.zon stringify ident" { |
| 1248 | 1248 | ||
| 1249 | try expectSerializeEqual(".{ .a = 0 }", .{ .a = 0 }, .{}); | 1249 | try expectSerializeEqual(".{ .a = 0 }", .{ .a = 0 }, .{}); |
| 1250 | try s.ident("a"); | 1250 | try s.ident("a"); |
| 1251 | try std.testing.expectEqualStrings(".a", aw.getWritten()); | 1251 | try std.testing.expectEqualStrings(".a", aw.written()); |
| 1252 | aw.clearRetainingCapacity(); | 1252 | aw.clearRetainingCapacity(); |
| 1253 | 1253 | ||
| 1254 | try s.ident("foo_1"); | 1254 | try s.ident("foo_1"); |
| 1255 | try std.testing.expectEqualStrings(".foo_1", aw.getWritten()); | 1255 | try std.testing.expectEqualStrings(".foo_1", aw.written()); |
| 1256 | aw.clearRetainingCapacity(); | 1256 | aw.clearRetainingCapacity(); |
| 1257 | 1257 | ||
| 1258 | try s.ident("_foo_1"); | 1258 | try s.ident("_foo_1"); |
| 1259 | try std.testing.expectEqualStrings("._foo_1", aw.getWritten()); | 1259 | try std.testing.expectEqualStrings("._foo_1", aw.written()); |
| 1260 | aw.clearRetainingCapacity(); | 1260 | aw.clearRetainingCapacity(); |
| 1261 | 1261 | ||
| 1262 | try s.ident("foo bar"); | 1262 | try s.ident("foo bar"); |
| 1263 | try std.testing.expectEqualStrings(".@\"foo bar\"", aw.getWritten()); | 1263 | try std.testing.expectEqualStrings(".@\"foo bar\"", aw.written()); |
| 1264 | aw.clearRetainingCapacity(); | 1264 | aw.clearRetainingCapacity(); |
| 1265 | 1265 | ||
| 1266 | try s.ident("1foo"); | 1266 | try s.ident("1foo"); |
| 1267 | try std.testing.expectEqualStrings(".@\"1foo\"", aw.getWritten()); | 1267 | try std.testing.expectEqualStrings(".@\"1foo\"", aw.written()); |
| 1268 | aw.clearRetainingCapacity(); | 1268 | aw.clearRetainingCapacity(); |
| 1269 | 1269 | ||
| 1270 | try s.ident("var"); | 1270 | try s.ident("var"); |
| 1271 | try std.testing.expectEqualStrings(".@\"var\"", aw.getWritten()); | 1271 | try std.testing.expectEqualStrings(".@\"var\"", aw.written()); |
| 1272 | aw.clearRetainingCapacity(); | 1272 | aw.clearRetainingCapacity(); |
| 1273 | 1273 | ||
| 1274 | try s.ident("true"); | 1274 | try s.ident("true"); |
| 1275 | try std.testing.expectEqualStrings(".true", aw.getWritten()); | 1275 | try std.testing.expectEqualStrings(".true", aw.written()); |
| 1276 | aw.clearRetainingCapacity(); | 1276 | aw.clearRetainingCapacity(); |
| 1277 | 1277 | ||
| 1278 | try s.ident("_"); | 1278 | try s.ident("_"); |
| 1279 | try std.testing.expectEqualStrings("._", aw.getWritten()); | 1279 | try std.testing.expectEqualStrings("._", aw.written()); |
| 1280 | aw.clearRetainingCapacity(); | 1280 | aw.clearRetainingCapacity(); |
| 1281 | 1281 | ||
| 1282 | const Enum = enum { | 1282 | const Enum = enum { |
| ... | @@ -1295,17 +1295,17 @@ test "std.zon stringify as tuple" { | ... | @@ -1295,17 +1295,17 @@ test "std.zon stringify as tuple" { |
| 1295 | 1295 | ||
| 1296 | // Tuples | 1296 | // Tuples |
| 1297 | try s.tuple(.{ 1, 2 }, .{}); | 1297 | try s.tuple(.{ 1, 2 }, .{}); |
| 1298 | try std.testing.expectEqualStrings(".{ 1, 2 }", aw.getWritten()); | 1298 | try std.testing.expectEqualStrings(".{ 1, 2 }", aw.written()); |
| 1299 | aw.clearRetainingCapacity(); | 1299 | aw.clearRetainingCapacity(); |
| 1300 | 1300 | ||
| 1301 | // Slice | 1301 | // Slice |
| 1302 | try s.tuple(@as([]const u8, &.{ 1, 2 }), .{}); | 1302 | try s.tuple(@as([]const u8, &.{ 1, 2 }), .{}); |
| 1303 | try std.testing.expectEqualStrings(".{ 1, 2 }", aw.getWritten()); | 1303 | try std.testing.expectEqualStrings(".{ 1, 2 }", aw.written()); |
| 1304 | aw.clearRetainingCapacity(); | 1304 | aw.clearRetainingCapacity(); |
| 1305 | 1305 | ||
| 1306 | // Array | 1306 | // Array |
| 1307 | try s.tuple([2]u8{ 1, 2 }, .{}); | 1307 | try s.tuple([2]u8{ 1, 2 }, .{}); |
| 1308 | try std.testing.expectEqualStrings(".{ 1, 2 }", aw.getWritten()); | 1308 | try std.testing.expectEqualStrings(".{ 1, 2 }", aw.written()); |
| 1309 | aw.clearRetainingCapacity(); | 1309 | aw.clearRetainingCapacity(); |
| 1310 | } | 1310 | } |
| 1311 | 1311 | ||
| ... | @@ -1316,12 +1316,12 @@ test "std.zon stringify as float" { | ... | @@ -1316,12 +1316,12 @@ test "std.zon stringify as float" { |
| 1316 | 1316 | ||
| 1317 | // Comptime float | 1317 | // Comptime float |
| 1318 | try s.float(2.5); | 1318 | try s.float(2.5); |
| 1319 | try std.testing.expectEqualStrings("2.5", aw.getWritten()); | 1319 | try std.testing.expectEqualStrings("2.5", aw.written()); |
| 1320 | aw.clearRetainingCapacity(); | 1320 | aw.clearRetainingCapacity(); |
| 1321 | 1321 | ||
| 1322 | // Sized float | 1322 | // Sized float |
| 1323 | try s.float(@as(f32, 2.5)); | 1323 | try s.float(@as(f32, 2.5)); |
| 1324 | try std.testing.expectEqualStrings("2.5", aw.getWritten()); | 1324 | try std.testing.expectEqualStrings("2.5", aw.written()); |
| 1325 | aw.clearRetainingCapacity(); | 1325 | aw.clearRetainingCapacity(); |
| 1326 | } | 1326 | } |
| 1327 | 1327 | ||
| ... | @@ -1446,7 +1446,7 @@ test "std.zon tuple/struct field" { | ... | @@ -1446,7 +1446,7 @@ test "std.zon tuple/struct field" { |
| 1446 | \\ .b = 1, | 1446 | \\ .b = 1, |
| 1447 | \\ }, | 1447 | \\ }, |
| 1448 | \\} | 1448 | \\} |
| 1449 | , aw.getWritten()); | 1449 | , aw.written()); |
| 1450 | aw.clearRetainingCapacity(); | 1450 | aw.clearRetainingCapacity(); |
| 1451 | } | 1451 | } |
| 1452 | 1452 | ||
| ... | @@ -1478,7 +1478,7 @@ test "std.zon tuple/struct field" { | ... | @@ -1478,7 +1478,7 @@ test "std.zon tuple/struct field" { |
| 1478 | \\ .b = 1, | 1478 | \\ .b = 1, |
| 1479 | \\ }, | 1479 | \\ }, |
| 1480 | \\} | 1480 | \\} |
| 1481 | , aw.getWritten()); | 1481 | , aw.written()); |
| 1482 | aw.clearRetainingCapacity(); | 1482 | aw.clearRetainingCapacity(); |
| 1483 | } | 1483 | } |
| 1484 | } | 1484 | } |
src/Compilation.zig+1-1| ... | @@ -1123,7 +1123,7 @@ pub const CObject = struct { | ... | @@ -1123,7 +1123,7 @@ pub const CObject = struct { |
| 1123 | var aw: Writer.Allocating = .init(eb.gpa); | 1123 | var aw: Writer.Allocating = .init(eb.gpa); |
| 1124 | defer aw.deinit(); | 1124 | defer aw.deinit(); |
| 1125 | _ = file_reader.interface.streamDelimiterEnding(&aw.writer, '\n') catch break :source_line 0; | 1125 | _ = file_reader.interface.streamDelimiterEnding(&aw.writer, '\n') catch break :source_line 0; |
| 1126 | break :source_line try eb.addString(aw.getWritten()); | 1126 | break :source_line try eb.addString(aw.written()); |
| 1127 | }; | 1127 | }; |
| 1128 | 1128 | ||
| 1129 | return .{ | 1129 | return .{ |
src/Package/Fetch.zig+2-2| ... | @@ -2029,7 +2029,7 @@ const UnpackResult = struct { | ... | @@ -2029,7 +2029,7 @@ const UnpackResult = struct { |
| 2029 | \\ note: unable to create symlink from 'dir2/file2' to 'filename': SymlinkError | 2029 | \\ note: unable to create symlink from 'dir2/file2' to 'filename': SymlinkError |
| 2030 | \\ note: file 'dir2/file4' has unsupported type 'x' | 2030 | \\ note: file 'dir2/file4' has unsupported type 'x' |
| 2031 | \\ | 2031 | \\ |
| 2032 | , aw.getWritten()); | 2032 | , aw.written()); |
| 2033 | } | 2033 | } |
| 2034 | }; | 2034 | }; |
| 2035 | 2035 | ||
| ... | @@ -2333,7 +2333,7 @@ const TestFetchBuilder = struct { | ... | @@ -2333,7 +2333,7 @@ const TestFetchBuilder = struct { |
| 2333 | var aw: std.io.Writer.Allocating = .init(std.testing.allocator); | 2333 | var aw: std.io.Writer.Allocating = .init(std.testing.allocator); |
| 2334 | defer aw.deinit(); | 2334 | defer aw.deinit(); |
| 2335 | try errors.renderToWriter(.{ .ttyconf = .no_color }, &aw.writer); | 2335 | try errors.renderToWriter(.{ .ttyconf = .no_color }, &aw.writer); |
| 2336 | try std.testing.expectEqualStrings(msg, aw.getWritten()); | 2336 | try std.testing.expectEqualStrings(msg, aw.written()); |
| 2337 | } | 2337 | } |
| 2338 | }; | 2338 | }; |
| 2339 | 2339 |
src/Sema.zig+5-5| ... | @@ -3071,7 +3071,7 @@ pub fn createTypeName( | ... | @@ -3071,7 +3071,7 @@ pub fn createTypeName( |
| 3071 | 3071 | ||
| 3072 | w.writeByte(')') catch return error.OutOfMemory; | 3072 | w.writeByte(')') catch return error.OutOfMemory; |
| 3073 | return .{ | 3073 | return .{ |
| 3074 | .name = try ip.getOrPutString(gpa, pt.tid, aw.getWritten(), .no_embedded_nulls), | 3074 | .name = try ip.getOrPutString(gpa, pt.tid, aw.written(), .no_embedded_nulls), |
| 3075 | .nav = .none, | 3075 | .nav = .none, |
| 3076 | }; | 3076 | }; |
| 3077 | }, | 3077 | }, |
| ... | @@ -5484,7 +5484,7 @@ fn zirCompileLog( | ... | @@ -5484,7 +5484,7 @@ fn zirCompileLog( |
| 5484 | } | 5484 | } |
| 5485 | } | 5485 | } |
| 5486 | 5486 | ||
| 5487 | const line_data = try zcu.intern_pool.getOrPutString(gpa, pt.tid, aw.getWritten(), .no_embedded_nulls); | 5487 | const line_data = try zcu.intern_pool.getOrPutString(gpa, pt.tid, aw.written(), .no_embedded_nulls); |
| 5488 | 5488 | ||
| 5489 | const line_idx: Zcu.CompileLogLine.Index = if (zcu.free_compile_log_lines.pop()) |idx| idx: { | 5489 | const line_idx: Zcu.CompileLogLine.Index = if (zcu.free_compile_log_lines.pop()) |idx| idx: { |
| 5490 | zcu.compile_log_lines.items[@intFromEnum(idx)] = .{ | 5490 | zcu.compile_log_lines.items[@intFromEnum(idx)] = .{ |
| ... | @@ -36892,11 +36892,11 @@ fn notePathToComptimeAllocPtr( | ... | @@ -36892,11 +36892,11 @@ fn notePathToComptimeAllocPtr( |
| 36892 | switch (deriv_start) { | 36892 | switch (deriv_start) { |
| 36893 | .int, .nav_ptr => unreachable, | 36893 | .int, .nav_ptr => unreachable, |
| 36894 | .uav_ptr => |uav| { | 36894 | .uav_ptr => |uav| { |
| 36895 | try sema.errNote(src, msg, "'{s}' points to '{s}', where", .{ first_path.items, second_path_aw.getWritten() }); | 36895 | try sema.errNote(src, msg, "'{s}' points to '{s}', where", .{ first_path.items, second_path_aw.written() }); |
| 36896 | return .{ .new_val = .fromInterned(uav.val) }; | 36896 | return .{ .new_val = .fromInterned(uav.val) }; |
| 36897 | }, | 36897 | }, |
| 36898 | .comptime_alloc_ptr => |cta_info| { | 36898 | .comptime_alloc_ptr => |cta_info| { |
| 36899 | try sema.errNote(src, msg, "'{s}' points to '{s}', where", .{ first_path.items, second_path_aw.getWritten() }); | 36899 | try sema.errNote(src, msg, "'{s}' points to '{s}', where", .{ first_path.items, second_path_aw.written() }); |
| 36900 | const cta = sema.getComptimeAlloc(cta_info.idx); | 36900 | const cta = sema.getComptimeAlloc(cta_info.idx); |
| 36901 | if (cta.is_const) { | 36901 | if (cta.is_const) { |
| 36902 | return .{ .new_val = cta_info.val }; | 36902 | return .{ .new_val = cta_info.val }; |
| ... | @@ -36906,7 +36906,7 @@ fn notePathToComptimeAllocPtr( | ... | @@ -36906,7 +36906,7 @@ fn notePathToComptimeAllocPtr( |
| 36906 | } | 36906 | } |
| 36907 | }, | 36907 | }, |
| 36908 | .comptime_field_ptr => { | 36908 | .comptime_field_ptr => { |
| 36909 | try sema.errNote(src, msg, "'{s}' points to '{s}', where", .{ first_path.items, second_path_aw.getWritten() }); | 36909 | try sema.errNote(src, msg, "'{s}' points to '{s}', where", .{ first_path.items, second_path_aw.written() }); |
| 36910 | try sema.errNote(src, msg, "'{s}' is a comptime field", .{inter_name}); | 36910 | try sema.errNote(src, msg, "'{s}' is a comptime field", .{inter_name}); |
| 36911 | return .done; | 36911 | return .done; |
| 36912 | }, | 36912 | }, |
src/codegen/c.zig+1-1| ... | @@ -728,7 +728,7 @@ pub const Object = struct { | ... | @@ -728,7 +728,7 @@ pub const Object = struct { |
| 728 | } | 728 | } |
| 729 | fn outdent(o: *Object) !void { | 729 | fn outdent(o: *Object) !void { |
| 730 | o.indent_counter -= indent_width; | 730 | o.indent_counter -= indent_width; |
| 731 | const written = o.code.getWritten(); | 731 | const written = o.code.written(); |
| 732 | switch (written[written.len - 1]) { | 732 | switch (written[written.len - 1]) { |
| 733 | indent_char => o.code.shrinkRetainingCapacity(written.len - indent_width), | 733 | indent_char => o.code.shrinkRetainingCapacity(written.len - indent_width), |
| 734 | '\n' => try o.code.writer.splatByteAll(indent_char, o.indent_counter), | 734 | '\n' => try o.code.writer.splatByteAll(indent_char, o.indent_counter), |
src/fmt.zig+2-2| ... | @@ -341,7 +341,7 @@ fn fmtPathFile( | ... | @@ -341,7 +341,7 @@ fn fmtPathFile( |
| 341 | tree.render(gpa, &fmt.out_buffer.writer, .{}) catch |err| switch (err) { | 341 | tree.render(gpa, &fmt.out_buffer.writer, .{}) catch |err| switch (err) { |
| 342 | error.WriteFailed, error.OutOfMemory => return error.OutOfMemory, | 342 | error.WriteFailed, error.OutOfMemory => return error.OutOfMemory, |
| 343 | }; | 343 | }; |
| 344 | if (mem.eql(u8, fmt.out_buffer.getWritten(), source_code)) | 344 | if (mem.eql(u8, fmt.out_buffer.written(), source_code)) |
| 345 | return; | 345 | return; |
| 346 | 346 | ||
| 347 | if (check_mode) { | 347 | if (check_mode) { |
| ... | @@ -351,7 +351,7 @@ fn fmtPathFile( | ... | @@ -351,7 +351,7 @@ fn fmtPathFile( |
| 351 | var af = try dir.atomicFile(sub_path, .{ .mode = stat.mode, .write_buffer = &.{} }); | 351 | var af = try dir.atomicFile(sub_path, .{ .mode = stat.mode, .write_buffer = &.{} }); |
| 352 | defer af.deinit(); | 352 | defer af.deinit(); |
| 353 | 353 | ||
| 354 | try af.file_writer.interface.writeAll(fmt.out_buffer.getWritten()); | 354 | try af.file_writer.interface.writeAll(fmt.out_buffer.written()); |
| 355 | try af.finish(); | 355 | try af.finish(); |
| 356 | try fmt.stdout_writer.interface.print("{s}\n", .{file_path}); | 356 | try fmt.stdout_writer.interface.print("{s}\n", .{file_path}); |
| 357 | } | 357 | } |
src/link/C.zig+7-7| ... | @@ -268,8 +268,8 @@ fn updateUav(self: *C, pt: Zcu.PerThread, i: usize) link.File.FlushError!void { | ... | @@ -268,8 +268,8 @@ fn updateUav(self: *C, pt: Zcu.PerThread, i: usize) link.File.FlushError!void { |
| 268 | 268 | ||
| 269 | object.dg.ctype_pool.freeUnusedCapacity(gpa); | 269 | object.dg.ctype_pool.freeUnusedCapacity(gpa); |
| 270 | self.uavs.values()[i] = .{ | 270 | self.uavs.values()[i] = .{ |
| 271 | .fwd_decl = try self.addString(object.dg.fwd_decl.getWritten()), | 271 | .fwd_decl = try self.addString(object.dg.fwd_decl.written()), |
| 272 | .code = try self.addString(object.code.getWritten()), | 272 | .code = try self.addString(object.code.written()), |
| 273 | .ctype_pool = object.dg.ctype_pool.move(), | 273 | .ctype_pool = object.dg.ctype_pool.move(), |
| 274 | }; | 274 | }; |
| 275 | } | 275 | } |
| ... | @@ -335,8 +335,8 @@ pub fn updateNav(self: *C, pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) l | ... | @@ -335,8 +335,8 @@ pub fn updateNav(self: *C, pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) l |
| 335 | }, | 335 | }, |
| 336 | error.WriteFailed, error.OutOfMemory => return error.OutOfMemory, | 336 | error.WriteFailed, error.OutOfMemory => return error.OutOfMemory, |
| 337 | }; | 337 | }; |
| 338 | gop.value_ptr.fwd_decl = try self.addString(object.dg.fwd_decl.getWritten()); | 338 | gop.value_ptr.fwd_decl = try self.addString(object.dg.fwd_decl.written()); |
| 339 | gop.value_ptr.code = try self.addString(object.code.getWritten()); | 339 | gop.value_ptr.code = try self.addString(object.code.written()); |
| 340 | try self.addUavsFromCodegen(&object.dg.uavs); | 340 | try self.addUavsFromCodegen(&object.dg.uavs); |
| 341 | } | 341 | } |
| 342 | 342 | ||
| ... | @@ -409,7 +409,7 @@ pub fn flush(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.P | ... | @@ -409,7 +409,7 @@ pub fn flush(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.P |
| 409 | // Covers defines, zig.h, ctypes, asm, lazy fwd. | 409 | // Covers defines, zig.h, ctypes, asm, lazy fwd. |
| 410 | try f.all_buffers.ensureUnusedCapacity(gpa, 5); | 410 | try f.all_buffers.ensureUnusedCapacity(gpa, 5); |
| 411 | 411 | ||
| 412 | f.appendBufAssumeCapacity(abi_defines_aw.getWritten()); | 412 | f.appendBufAssumeCapacity(abi_defines_aw.written()); |
| 413 | f.appendBufAssumeCapacity(zig_h); | 413 | f.appendBufAssumeCapacity(zig_h); |
| 414 | 414 | ||
| 415 | const ctypes_index = f.all_buffers.items.len; | 415 | const ctypes_index = f.all_buffers.items.len; |
| ... | @@ -420,7 +420,7 @@ pub fn flush(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.P | ... | @@ -420,7 +420,7 @@ pub fn flush(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.P |
| 420 | codegen.genGlobalAsm(zcu, &asm_aw.writer) catch |err| switch (err) { | 420 | codegen.genGlobalAsm(zcu, &asm_aw.writer) catch |err| switch (err) { |
| 421 | error.WriteFailed => return error.OutOfMemory, | 421 | error.WriteFailed => return error.OutOfMemory, |
| 422 | }; | 422 | }; |
| 423 | f.appendBufAssumeCapacity(asm_aw.getWritten()); | 423 | f.appendBufAssumeCapacity(asm_aw.written()); |
| 424 | 424 | ||
| 425 | const lazy_index = f.all_buffers.items.len; | 425 | const lazy_index = f.all_buffers.items.len; |
| 426 | f.all_buffers.items.len += 1; | 426 | f.all_buffers.items.len += 1; |
| ... | @@ -849,7 +849,7 @@ pub fn updateExports( | ... | @@ -849,7 +849,7 @@ pub fn updateExports( |
| 849 | codegen.genExports(&dg, exported, export_indices) catch |err| switch (err) { | 849 | codegen.genExports(&dg, exported, export_indices) catch |err| switch (err) { |
| 850 | error.WriteFailed, error.OutOfMemory => return error.OutOfMemory, | 850 | error.WriteFailed, error.OutOfMemory => return error.OutOfMemory, |
| 851 | }; | 851 | }; |
| 852 | exported_block.* = .{ .fwd_decl = try self.addString(dg.fwd_decl.getWritten()) }; | 852 | exported_block.* = .{ .fwd_decl = try self.addString(dg.fwd_decl.written()) }; |
| 853 | } | 853 | } |
| 854 | 854 | ||
| 855 | pub fn deleteExport( | 855 | pub fn deleteExport( |
src/link/Dwarf.zig+25-25| ... | @@ -748,7 +748,7 @@ const Unit = struct { | ... | @@ -748,7 +748,7 @@ const Unit = struct { |
| 748 | assert(tw.end == unit.trailer_len); | 748 | assert(tw.end == unit.trailer_len); |
| 749 | tw.splatByteAll(fill_byte, len - unit.trailer_len) catch unreachable; | 749 | tw.splatByteAll(fill_byte, len - unit.trailer_len) catch unreachable; |
| 750 | assert(tw.end == len); | 750 | assert(tw.end == len); |
| 751 | try dwarf.getFile().?.pwriteAll(trailer_aw.getWritten(), sec.off(dwarf) + start); | 751 | try dwarf.getFile().?.pwriteAll(trailer_aw.written(), sec.off(dwarf) + start); |
| 752 | } | 752 | } |
| 753 | 753 | ||
| 754 | fn resolveRelocs(unit: *Unit, sec: *Section, dwarf: *Dwarf) RelocError!void { | 754 | fn resolveRelocs(unit: *Unit, sec: *Section, dwarf: *Dwarf) RelocError!void { |
| ... | @@ -1719,10 +1719,10 @@ pub const WipNav = struct { | ... | @@ -1719,10 +1719,10 @@ pub const WipNav = struct { |
| 1719 | else | 1719 | else |
| 1720 | std.leb.writeUnsignedFixed( | 1720 | std.leb.writeUnsignedFixed( |
| 1721 | block_bytes, | 1721 | block_bytes, |
| 1722 | wip_nav.debug_info.getWritten()[block.abbrev_code..][0..block_bytes], | 1722 | wip_nav.debug_info.written()[block.abbrev_code..][0..block_bytes], |
| 1723 | try wip_nav.dwarf.refAbbrevCode(.empty_block), | 1723 | try wip_nav.dwarf.refAbbrevCode(.empty_block), |
| 1724 | ); | 1724 | ); |
| 1725 | std.mem.writeInt(u32, wip_nav.debug_info.getWritten()[block.high_pc..][0..4], @intCast(code_off - block.low_pc_off), wip_nav.dwarf.endian); | 1725 | std.mem.writeInt(u32, wip_nav.debug_info.written()[block.high_pc..][0..4], @intCast(code_off - block.low_pc_off), wip_nav.dwarf.endian); |
| 1726 | wip_nav.any_children = true; | 1726 | wip_nav.any_children = true; |
| 1727 | } | 1727 | } |
| 1728 | 1728 | ||
| ... | @@ -1781,10 +1781,10 @@ pub const WipNav = struct { | ... | @@ -1781,10 +1781,10 @@ pub const WipNav = struct { |
| 1781 | else | 1781 | else |
| 1782 | std.leb.writeUnsignedFixed( | 1782 | std.leb.writeUnsignedFixed( |
| 1783 | inlined_func_bytes, | 1783 | inlined_func_bytes, |
| 1784 | wip_nav.debug_info.getWritten()[block.abbrev_code..][0..inlined_func_bytes], | 1784 | wip_nav.debug_info.written()[block.abbrev_code..][0..inlined_func_bytes], |
| 1785 | try wip_nav.dwarf.refAbbrevCode(.empty_inlined_func), | 1785 | try wip_nav.dwarf.refAbbrevCode(.empty_inlined_func), |
| 1786 | ); | 1786 | ); |
| 1787 | std.mem.writeInt(u32, wip_nav.debug_info.getWritten()[block.high_pc..][0..4], @intCast(code_off - block.low_pc_off), wip_nav.dwarf.endian); | 1787 | std.mem.writeInt(u32, wip_nav.debug_info.written()[block.high_pc..][0..4], @intCast(code_off - block.low_pc_off), wip_nav.dwarf.endian); |
| 1788 | try wip_nav.setInlineFunc(func); | 1788 | try wip_nav.setInlineFunc(func); |
| 1789 | wip_nav.any_children = true; | 1789 | wip_nav.any_children = true; |
| 1790 | } | 1790 | } |
| ... | @@ -2282,7 +2282,7 @@ pub const WipNav = struct { | ... | @@ -2282,7 +2282,7 @@ pub const WipNav = struct { |
| 2282 | 2282 | ||
| 2283 | if (!is_generic_decl) return; | 2283 | if (!is_generic_decl) return; |
| 2284 | const generic_decl_entry = wip_nav.entry; | 2284 | const generic_decl_entry = wip_nav.entry; |
| 2285 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, generic_decl_entry, dwarf, wip_nav.debug_info.getWritten()); | 2285 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, generic_decl_entry, dwarf, wip_nav.debug_info.written()); |
| 2286 | wip_nav.debug_info.clearRetainingCapacity(); | 2286 | wip_nav.debug_info.clearRetainingCapacity(); |
| 2287 | wip_nav.entry = orig_entry; | 2287 | wip_nav.entry = orig_entry; |
| 2288 | try wip_nav.abbrevCode(abbrev_code.decl_instance); | 2288 | try wip_nav.abbrevCode(abbrev_code.decl_instance); |
| ... | @@ -2851,7 +2851,7 @@ fn finishWipNavFuncWriterError( | ... | @@ -2851,7 +2851,7 @@ fn finishWipNavFuncWriterError( |
| 2851 | DW.CFA.nop, | 2851 | DW.CFA.nop, |
| 2852 | @intCast(dwarf.debug_frame.section.alignment.forward(dfw.end) - dfw.end), | 2852 | @intCast(dwarf.debug_frame.section.alignment.forward(dfw.end) - dfw.end), |
| 2853 | ); | 2853 | ); |
| 2854 | const contents = wip_nav.debug_frame.getWritten(); | 2854 | const contents = wip_nav.debug_frame.written(); |
| 2855 | try dwarf.debug_frame.section.resizeEntry(wip_nav.unit, wip_nav.entry, dwarf, @intCast(contents.len)); | 2855 | try dwarf.debug_frame.section.resizeEntry(wip_nav.unit, wip_nav.entry, dwarf, @intCast(contents.len)); |
| 2856 | const unit = dwarf.debug_frame.section.getUnit(wip_nav.unit); | 2856 | const unit = dwarf.debug_frame.section.getUnit(wip_nav.unit); |
| 2857 | const entry = unit.getEntry(wip_nav.entry); | 2857 | const entry = unit.getEntry(wip_nav.entry); |
| ... | @@ -2878,12 +2878,12 @@ fn finishWipNavFuncWriterError( | ... | @@ -2878,12 +2878,12 @@ fn finishWipNavFuncWriterError( |
| 2878 | }, | 2878 | }, |
| 2879 | } | 2879 | } |
| 2880 | { | 2880 | { |
| 2881 | std.mem.writeInt(u32, wip_nav.debug_info.getWritten()[wip_nav.func_high_pc..][0..4], @intCast(code_size), dwarf.endian); | 2881 | std.mem.writeInt(u32, wip_nav.debug_info.written()[wip_nav.func_high_pc..][0..4], @intCast(code_size), dwarf.endian); |
| 2882 | if (wip_nav.any_children) { | 2882 | if (wip_nav.any_children) { |
| 2883 | const diw = &wip_nav.debug_info.writer; | 2883 | const diw = &wip_nav.debug_info.writer; |
| 2884 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | 2884 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); |
| 2885 | } else { | 2885 | } else { |
| 2886 | const abbrev_code_buf = wip_nav.debug_info.getWritten()[0..AbbrevCode.decl_bytes]; | 2886 | const abbrev_code_buf = wip_nav.debug_info.written()[0..AbbrevCode.decl_bytes]; |
| 2887 | var abbrev_code_fr: std.Io.Reader = .fixed(abbrev_code_buf); | 2887 | var abbrev_code_fr: std.Io.Reader = .fixed(abbrev_code_buf); |
| 2888 | const abbrev_code: AbbrevCode = @enumFromInt( | 2888 | const abbrev_code: AbbrevCode = @enumFromInt( |
| 2889 | abbrev_code_fr.takeLeb128(@typeInfo(AbbrevCode).@"enum".tag_type) catch unreachable, | 2889 | abbrev_code_fr.takeLeb128(@typeInfo(AbbrevCode).@"enum".tag_type) catch unreachable, |
| ... | @@ -2944,15 +2944,15 @@ fn finishWipNavWriterError( | ... | @@ -2944,15 +2944,15 @@ fn finishWipNavWriterError( |
| 2944 | const nav = ip.getNav(nav_index); | 2944 | const nav = ip.getNav(nav_index); |
| 2945 | log.debug("finishWipNav({f})", .{nav.fqn.fmt(ip)}); | 2945 | log.debug("finishWipNav({f})", .{nav.fqn.fmt(ip)}); |
| 2946 | 2946 | ||
| 2947 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.getWritten()); | 2947 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 2948 | const dlw = &wip_nav.debug_line.writer; | 2948 | const dlw = &wip_nav.debug_line.writer; |
| 2949 | if (dlw.end > 0) { | 2949 | if (dlw.end > 0) { |
| 2950 | try dlw.writeByte(DW.LNS.extended_op); | 2950 | try dlw.writeByte(DW.LNS.extended_op); |
| 2951 | try dlw.writeUleb128(1); | 2951 | try dlw.writeUleb128(1); |
| 2952 | try dlw.writeByte(DW.LNE.end_sequence); | 2952 | try dlw.writeByte(DW.LNE.end_sequence); |
| 2953 | try dwarf.debug_line.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_line.getWritten()); | 2953 | try dwarf.debug_line.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_line.written()); |
| 2954 | } | 2954 | } |
| 2955 | try dwarf.debug_loclists.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_loclists.getWritten()); | 2955 | try dwarf.debug_loclists.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_loclists.written()); |
| 2956 | 2956 | ||
| 2957 | try wip_nav.updateLazy(zcu.navSrcLoc(nav_index)); | 2957 | try wip_nav.updateLazy(zcu.navSrcLoc(nav_index)); |
| 2958 | } | 2958 | } |
| ... | @@ -3407,7 +3407,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo | ... | @@ -3407,7 +3407,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 3407 | try wip_nav.refNav(owner_nav); | 3407 | try wip_nav.refNav(owner_nav); |
| 3408 | }, | 3408 | }, |
| 3409 | } | 3409 | } |
| 3410 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.getWritten()); | 3410 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 3411 | try wip_nav.updateLazy(nav_src_loc); | 3411 | try wip_nav.updateLazy(nav_src_loc); |
| 3412 | } | 3412 | } |
| 3413 | 3413 | ||
| ... | @@ -3914,7 +3914,7 @@ fn updateLazyType( | ... | @@ -3914,7 +3914,7 @@ fn updateLazyType( |
| 3914 | .memoized_call, | 3914 | .memoized_call, |
| 3915 | => unreachable, | 3915 | => unreachable, |
| 3916 | } | 3916 | } |
| 3917 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.getWritten()); | 3917 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 3918 | } | 3918 | } |
| 3919 | 3919 | ||
| 3920 | fn updateLazyValue( | 3920 | fn updateLazyValue( |
| ... | @@ -4288,7 +4288,7 @@ fn updateLazyValue( | ... | @@ -4288,7 +4288,7 @@ fn updateLazyValue( |
| 4288 | }, | 4288 | }, |
| 4289 | .memoized_call => unreachable, // not a value | 4289 | .memoized_call => unreachable, // not a value |
| 4290 | } | 4290 | } |
| 4291 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.getWritten()); | 4291 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 4292 | } | 4292 | } |
| 4293 | 4293 | ||
| 4294 | fn optRepr(opt_child_type: Type, zcu: *const Zcu) enum { | 4294 | fn optRepr(opt_child_type: Type, zcu: *const Zcu) enum { |
| ... | @@ -4411,7 +4411,7 @@ fn updateContainerTypeWriterError( | ... | @@ -4411,7 +4411,7 @@ fn updateContainerTypeWriterError( |
| 4411 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | 4411 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); |
| 4412 | } | 4412 | } |
| 4413 | 4413 | ||
| 4414 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.getWritten()); | 4414 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 4415 | try wip_nav.updateLazy(ty_src_loc); | 4415 | try wip_nav.updateLazy(ty_src_loc); |
| 4416 | } else { | 4416 | } else { |
| 4417 | { | 4417 | { |
| ... | @@ -4611,8 +4611,8 @@ fn updateContainerTypeWriterError( | ... | @@ -4611,8 +4611,8 @@ fn updateContainerTypeWriterError( |
| 4611 | }, | 4611 | }, |
| 4612 | else => unreachable, | 4612 | else => unreachable, |
| 4613 | } | 4613 | } |
| 4614 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.getWritten()); | 4614 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 4615 | try dwarf.debug_loclists.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_loclists.getWritten()); | 4615 | try dwarf.debug_loclists.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_loclists.written()); |
| 4616 | try wip_nav.updateLazy(ty_src_loc); | 4616 | try wip_nav.updateLazy(ty_src_loc); |
| 4617 | } | 4617 | } |
| 4618 | } | 4618 | } |
| ... | @@ -4661,7 +4661,7 @@ fn refAbbrevCode( | ... | @@ -4661,7 +4661,7 @@ fn refAbbrevCode( |
| 4661 | try daw.writeByte(if (abbrev.children) DW.CHILDREN.yes else DW.CHILDREN.no); | 4661 | try daw.writeByte(if (abbrev.children) DW.CHILDREN.yes else DW.CHILDREN.no); |
| 4662 | for (abbrev.attrs) |*attr| inline for (attr) |info| try daw.writeUleb128(@intFromEnum(info)); | 4662 | for (abbrev.attrs) |*attr| inline for (attr) |info| try daw.writeUleb128(@intFromEnum(info)); |
| 4663 | for (0..2) |_| try daw.writeUleb128(0); | 4663 | for (0..2) |_| try daw.writeUleb128(0); |
| 4664 | try dwarf.debug_abbrev.section.replaceEntry(DebugAbbrev.unit, entry, dwarf, debug_abbrev_aw.getWritten()); | 4664 | try dwarf.debug_abbrev.section.replaceEntry(DebugAbbrev.unit, entry, dwarf, debug_abbrev_aw.written()); |
| 4665 | return @intFromEnum(abbrev_code); | 4665 | return @intFromEnum(abbrev_code); |
| 4666 | } | 4666 | } |
| 4667 | 4667 | ||
| ... | @@ -4710,7 +4710,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro | ... | @@ -4710,7 +4710,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro |
| 4710 | try wip_nav.strp(name.toSlice(ip)); | 4710 | try wip_nav.strp(name.toSlice(ip)); |
| 4711 | } | 4711 | } |
| 4712 | if (global_error_set_names.len > 0) try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | 4712 | if (global_error_set_names.len > 0) try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); |
| 4713 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.getWritten()); | 4713 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 4714 | try wip_nav.updateLazy(.unneeded); | 4714 | try wip_nav.updateLazy(.unneeded); |
| 4715 | } | 4715 | } |
| 4716 | 4716 | ||
| ... | @@ -4751,7 +4751,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro | ... | @@ -4751,7 +4751,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro |
| 4751 | hw.writeByte(@intFromEnum(dwarf.address_size)) catch unreachable; | 4751 | hw.writeByte(@intFromEnum(dwarf.address_size)) catch unreachable; |
| 4752 | hw.writeByte(0) catch unreachable; | 4752 | hw.writeByte(0) catch unreachable; |
| 4753 | hw.splatByteAll(0, unit_ptr.header_len - hw.end) catch unreachable; | 4753 | hw.splatByteAll(0, unit_ptr.header_len - hw.end) catch unreachable; |
| 4754 | try unit_ptr.replaceHeader(&dwarf.debug_aranges.section, dwarf, header_aw.getWritten()); | 4754 | try unit_ptr.replaceHeader(&dwarf.debug_aranges.section, dwarf, header_aw.written()); |
| 4755 | try unit_ptr.writeTrailer(&dwarf.debug_aranges.section, dwarf); | 4755 | try unit_ptr.writeTrailer(&dwarf.debug_aranges.section, dwarf); |
| 4756 | } | 4756 | } |
| 4757 | dwarf.debug_aranges.section.dirty = false; | 4757 | dwarf.debug_aranges.section.dirty = false; |
| ... | @@ -4790,7 +4790,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro | ... | @@ -4790,7 +4790,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro |
| 4790 | hw.writeByte(@as(u8, DW.CFA.offset) + Register.rip.dwarfNum()) catch unreachable; | 4790 | hw.writeByte(@as(u8, DW.CFA.offset) + Register.rip.dwarfNum()) catch unreachable; |
| 4791 | hw.writeUleb128(1) catch unreachable; | 4791 | hw.writeUleb128(1) catch unreachable; |
| 4792 | hw.splatByteAll(DW.CFA.nop, unit.header_len - hw.end) catch unreachable; | 4792 | hw.splatByteAll(DW.CFA.nop, unit.header_len - hw.end) catch unreachable; |
| 4793 | try unit.replaceHeader(&dwarf.debug_frame.section, dwarf, header_aw.getWritten()); | 4793 | try unit.replaceHeader(&dwarf.debug_frame.section, dwarf, header_aw.written()); |
| 4794 | try unit.writeTrailer(&dwarf.debug_frame.section, dwarf); | 4794 | try unit.writeTrailer(&dwarf.debug_frame.section, dwarf); |
| 4795 | } | 4795 | } |
| 4796 | }, | 4796 | }, |
| ... | @@ -4880,7 +4880,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro | ... | @@ -4880,7 +4880,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro |
| 4880 | }); | 4880 | }); |
| 4881 | hw.splatByteAll(0, dwarf.sectionOffsetBytes()) catch unreachable; | 4881 | hw.splatByteAll(0, dwarf.sectionOffsetBytes()) catch unreachable; |
| 4882 | hw.writeUleb128(0) catch unreachable; | 4882 | hw.writeUleb128(0) catch unreachable; |
| 4883 | try unit_ptr.replaceHeader(&dwarf.debug_info.section, dwarf, header_aw.getWritten()); | 4883 | try unit_ptr.replaceHeader(&dwarf.debug_info.section, dwarf, header_aw.written()); |
| 4884 | try unit_ptr.writeTrailer(&dwarf.debug_info.section, dwarf); | 4884 | try unit_ptr.writeTrailer(&dwarf.debug_info.section, dwarf); |
| 4885 | } | 4885 | } |
| 4886 | dwarf.debug_info.section.dirty = false; | 4886 | dwarf.debug_info.section.dirty = false; |
| ... | @@ -4997,7 +4997,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro | ... | @@ -4997,7 +4997,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro |
| 4997 | }); | 4997 | }); |
| 4998 | hw.splatByteAll(0, dwarf.sectionOffsetBytes()) catch unreachable; | 4998 | hw.splatByteAll(0, dwarf.sectionOffsetBytes()) catch unreachable; |
| 4999 | } | 4999 | } |
| 5000 | try unit.replaceHeader(&dwarf.debug_line.section, dwarf, header_aw.getWritten()); | 5000 | try unit.replaceHeader(&dwarf.debug_line.section, dwarf, header_aw.written()); |
| 5001 | try unit.writeTrailer(&dwarf.debug_line.section, dwarf); | 5001 | try unit.writeTrailer(&dwarf.debug_line.section, dwarf); |
| 5002 | } | 5002 | } |
| 5003 | dwarf.debug_line.section.dirty = false; | 5003 | dwarf.debug_line.section.dirty = false; |
| ... | @@ -5034,7 +5034,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro | ... | @@ -5034,7 +5034,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (FlushError || Writer.Erro |
| 5034 | .@"32" => hw.writeInt(u32, dwarf.sectionOffsetBytes() * 1, dwarf.endian) catch unreachable, | 5034 | .@"32" => hw.writeInt(u32, dwarf.sectionOffsetBytes() * 1, dwarf.endian) catch unreachable, |
| 5035 | .@"64" => hw.writeInt(u64, dwarf.sectionOffsetBytes() * 1, dwarf.endian) catch unreachable, | 5035 | .@"64" => hw.writeInt(u64, dwarf.sectionOffsetBytes() * 1, dwarf.endian) catch unreachable, |
| 5036 | } | 5036 | } |
| 5037 | try unit.replaceHeader(&dwarf.debug_rnglists.section, dwarf, header_aw.getWritten()); | 5037 | try unit.replaceHeader(&dwarf.debug_rnglists.section, dwarf, header_aw.written()); |
| 5038 | try unit.writeTrailer(&dwarf.debug_rnglists.section, dwarf); | 5038 | try unit.writeTrailer(&dwarf.debug_rnglists.section, dwarf); |
| 5039 | } | 5039 | } |
| 5040 | dwarf.debug_rnglists.section.dirty = false; | 5040 | dwarf.debug_rnglists.section.dirty = false; |
src/link/Elf.zig+1-1| ... | @@ -3156,7 +3156,7 @@ fn writeSyntheticSections(self: *Elf) !void { | ... | @@ -3156,7 +3156,7 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 3156 | try aw.ensureUnusedCapacity(self.gnu_hash.size()); | 3156 | try aw.ensureUnusedCapacity(self.gnu_hash.size()); |
| 3157 | defer aw.deinit(); | 3157 | defer aw.deinit(); |
| 3158 | try self.gnu_hash.write(self, &aw.writer); | 3158 | try self.gnu_hash.write(self, &aw.writer); |
| 3159 | try self.pwriteAll(aw.getWritten(), shdr.sh_offset); | 3159 | try self.pwriteAll(aw.written(), shdr.sh_offset); |
| 3160 | } | 3160 | } |
| 3161 | 3161 | ||
| 3162 | if (self.section_indexes.versym) |shndx| { | 3162 | if (self.section_indexes.versym) |shndx| { |
src/link/SpirV.zig+1-1| ... | @@ -274,7 +274,7 @@ pub fn flush( | ... | @@ -274,7 +274,7 @@ pub fn flush( |
| 274 | ) catch return error.OutOfMemory; | 274 | ) catch return error.OutOfMemory; |
| 275 | } | 275 | } |
| 276 | try linker.module.sections.debug_strings.emit(gpa, .OpSourceExtension, .{ | 276 | try linker.module.sections.debug_strings.emit(gpa, .OpSourceExtension, .{ |
| 277 | .extension = error_info.getWritten(), | 277 | .extension = error_info.written(), |
| 278 | }); | 278 | }); |
| 279 | 279 | ||
| 280 | const module = try linker.module.finalize(arena); | 280 | const module = try linker.module.finalize(arena); |
src/main.zig+1-1| ... | @@ -7198,7 +7198,7 @@ fn cmdFetch( | ... | @@ -7198,7 +7198,7 @@ fn cmdFetch( |
| 7198 | var aw: std.Io.Writer.Allocating = .init(gpa); | 7198 | var aw: std.Io.Writer.Allocating = .init(gpa); |
| 7199 | defer aw.deinit(); | 7199 | defer aw.deinit(); |
| 7200 | try ast.render(gpa, &aw.writer, fixups); | 7200 | try ast.render(gpa, &aw.writer, fixups); |
| 7201 | const rendered = aw.getWritten(); | 7201 | const rendered = aw.written(); |
| 7202 | 7202 | ||
| 7203 | build_root.directory.handle.writeFile(.{ .sub_path = Package.Manifest.basename, .data = rendered }) catch |err| { | 7203 | build_root.directory.handle.writeFile(.{ .sub_path = Package.Manifest.basename, .data = rendered }) catch |err| { |
| 7204 | fatal("unable to write {s} file: {t}", .{ Package.Manifest.basename, err }); | 7204 | fatal("unable to write {s} file: {t}", .{ Package.Manifest.basename, err }); |