| author | |
| committer | |
| log | dd4eb86bc1614de29cdbdfee1c5dcbea78eee9c7 |
| tree | 4159c0f6c08749da6feec42652f40d8c65856cf1 |
| parent | c9915e949ebd4aa0d4d24ef5808ba0b1cff2ecfe |
5 files changed, 73 insertions(+), 68 deletions(-)
src/InternPool.zig+14-9| ... | ... | @@ -1887,18 +1887,23 @@ pub const NullTerminatedString = enum(u32) { |
| 1887 | 1887 | const FormatData = struct { |
| 1888 | 1888 | string: NullTerminatedString, |
| 1889 | 1889 | ip: *const InternPool, |
| 1890 | id: bool, | |
| 1890 | 1891 | }; |
| 1891 | fn format(data: FormatData, bw: *std.io.Writer, comptime specifier: []const u8) std.io.Writer.Error!void { | |
| 1892 | fn format(data: FormatData, writer: *std.io.Writer) std.io.Writer.Error!void { | |
| 1892 | 1893 | const slice = data.string.toSlice(data.ip); |
| 1893 | if (comptime std.mem.eql(u8, specifier, "")) { | |
| 1894 | try bw.writeAll(slice); | |
| 1895 | } else if (comptime std.mem.eql(u8, specifier, "i")) { | |
| 1896 | try bw.print("{fp}", .{std.zig.fmtId(slice)}); | |
| 1897 | } else @compileError("invalid format string '" ++ specifier ++ "' for '" ++ @typeName(NullTerminatedString) ++ "'"); | |
| 1894 | if (!data.id) { | |
| 1895 | try writer.writeAll(slice); | |
| 1896 | } else { | |
| 1897 | try writer.print("{f}", .{std.zig.fmtIdP(slice)}); | |
| 1898 | } | |
| 1899 | } | |
| 1900 | ||
| 1901 | pub fn fmt(string: NullTerminatedString, ip: *const InternPool) std.fmt.Formatter(FormatData, format) { | |
| 1902 | return .{ .data = .{ .string = string, .ip = ip, .id = false } }; | |
| 1898 | 1903 | } |
| 1899 | 1904 | |
| 1900 | pub fn fmt(string: NullTerminatedString, ip: *const InternPool) std.fmt.Formatter(format) { | |
| 1901 | return .{ .data = .{ .string = string, .ip = ip } }; | |
| 1905 | pub fn fmtId(string: NullTerminatedString, ip: *const InternPool) std.fmt.Formatter(FormatData, format) { | |
| 1906 | return .{ .data = .{ .string = string, .ip = ip, .id = true } }; | |
| 1902 | 1907 | } |
| 1903 | 1908 | |
| 1904 | 1909 | const debug_state = InternPool.debug_state; |
| ... | ... | @@ -11409,7 +11414,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator) |
| 11409 | 11414 | var it = instances.iterator(); |
| 11410 | 11415 | while (it.next()) |entry| { |
| 11411 | 11416 | const generic_fn_owner_nav = ip.getNav(ip.funcDeclInfo(entry.key_ptr.*).owner_nav); |
| 11412 | try stderr_bw.print("{f} ({}): \n", .{ generic_fn_owner_nav.name.fmt(ip), entry.value_ptr.items.len }); | |
| 11417 | try stderr_bw.print("{f} ({d}): \n", .{ generic_fn_owner_nav.name.fmt(ip), entry.value_ptr.items.len }); | |
| 11413 | 11418 | for (entry.value_ptr.items) |index| { |
| 11414 | 11419 | const unwrapped_index = index.unwrap(ip); |
| 11415 | 11420 | const func = ip.extraFuncInstance(unwrapped_index.tid, unwrapped_index.getExtra(ip), unwrapped_index.getData(ip)); |
src/crash_report.zig+40-40| ... | ... | @@ -80,19 +80,19 @@ fn dumpStatusReport() !void { |
| 80 | 80 | var fba = std.heap.FixedBufferAllocator.init(&crash_heap); |
| 81 | 81 | const allocator = fba.allocator(); |
| 82 | 82 | |
| 83 | var stderr_fw = std.fs.File.stderr().writer(); | |
| 84 | var stderr_bw = stderr_fw.interface().unbuffered(); | |
| 83 | var stderr_fw = std.fs.File.stderr().writer(&.{}); | |
| 84 | const stderr = &stderr_fw.interface; | |
| 85 | 85 | const block: *Sema.Block = anal.block; |
| 86 | 86 | const zcu = anal.sema.pt.zcu; |
| 87 | 87 | |
| 88 | 88 | const file, const src_base_node = Zcu.LazySrcLoc.resolveBaseNode(block.src_base_inst, zcu) orelse { |
| 89 | 89 | const file = zcu.fileByIndex(block.src_base_inst.resolveFile(&zcu.intern_pool)); |
| 90 | try stderr_bw.print("Analyzing lost instruction in file '{f}'. This should not happen!\n\n", .{file.path.fmt(zcu.comp)}); | |
| 90 | try stderr.print("Analyzing lost instruction in file '{f}'. This should not happen!\n\n", .{file.path.fmt(zcu.comp)}); | |
| 91 | 91 | return; |
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | try stderr_bw.writeAll("Analyzing "); | |
| 95 | try stderr_bw.print("Analyzing '{f}'\n", .{file.path.fmt(zcu.comp)}); | |
| 94 | try stderr.writeAll("Analyzing "); | |
| 95 | try stderr.print("Analyzing '{f}'\n", .{file.path.fmt(zcu.comp)}); | |
| 96 | 96 | |
| 97 | 97 | print_zir.renderInstructionContext( |
| 98 | 98 | allocator, |
| ... | ... | @@ -101,12 +101,12 @@ fn dumpStatusReport() !void { |
| 101 | 101 | file, |
| 102 | 102 | src_base_node, |
| 103 | 103 | 6, // indent |
| 104 | &stderr_bw, | |
| 104 | stderr, | |
| 105 | 105 | ) catch |err| switch (err) { |
| 106 | error.OutOfMemory => try stderr_bw.writeAll(" <out of memory dumping zir>\n"), | |
| 106 | error.OutOfMemory => try stderr.writeAll(" <out of memory dumping zir>\n"), | |
| 107 | 107 | else => |e| return e, |
| 108 | 108 | }; |
| 109 | try stderr_bw.print( | |
| 109 | try stderr.print( | |
| 110 | 110 | \\ For full context, use the command |
| 111 | 111 | \\ zig ast-check -t {f} |
| 112 | 112 | \\ |
| ... | ... | @@ -117,30 +117,30 @@ fn dumpStatusReport() !void { |
| 117 | 117 | while (parent) |curr| { |
| 118 | 118 | fba.reset(); |
| 119 | 119 | const cur_block_file = zcu.fileByIndex(curr.block.src_base_inst.resolveFile(&zcu.intern_pool)); |
| 120 | try stderr_bw.print(" in {f}\n", .{cur_block_file.path.fmt(zcu.comp)}); | |
| 120 | try stderr.print(" in {f}\n", .{cur_block_file.path.fmt(zcu.comp)}); | |
| 121 | 121 | _, const cur_block_src_base_node = Zcu.LazySrcLoc.resolveBaseNode(curr.block.src_base_inst, zcu) orelse { |
| 122 | try stderr_bw.writeAll(" > [lost instruction; this should not happen]\n"); | |
| 122 | try stderr.writeAll(" > [lost instruction; this should not happen]\n"); | |
| 123 | 123 | parent = curr.parent; |
| 124 | 124 | continue; |
| 125 | 125 | }; |
| 126 | try stderr_bw.writeAll(" > "); | |
| 126 | try stderr.writeAll(" > "); | |
| 127 | 127 | print_zir.renderSingleInstruction( |
| 128 | 128 | allocator, |
| 129 | 129 | curr.body[curr.body_index], |
| 130 | 130 | cur_block_file, |
| 131 | 131 | cur_block_src_base_node, |
| 132 | 132 | 6, // indent |
| 133 | &stderr_bw, | |
| 133 | stderr, | |
| 134 | 134 | ) catch |err| switch (err) { |
| 135 | error.OutOfMemory => try stderr_bw.writeAll(" <out of memory dumping zir>\n"), | |
| 135 | error.OutOfMemory => try stderr.writeAll(" <out of memory dumping zir>\n"), | |
| 136 | 136 | else => |e| return e, |
| 137 | 137 | }; |
| 138 | try stderr_bw.writeAll("\n"); | |
| 138 | try stderr.writeAll("\n"); | |
| 139 | 139 | |
| 140 | 140 | parent = curr.parent; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | try stderr_bw.writeByte('\n'); | |
| 143 | try stderr.writeByte('\n'); | |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | var crash_heap: [16 * 4096]u8 = undefined; |
| ... | ... | @@ -269,9 +269,9 @@ const StackContext = union(enum) { |
| 269 | 269 | debug.dumpCurrentStackTrace(ct.ret_addr); |
| 270 | 270 | }, |
| 271 | 271 | .exception => |context| { |
| 272 | var stderr_fw = std.fs.File.stderr().writer(); | |
| 273 | var stderr_bw = stderr_fw.interface().unbuffered(); | |
| 274 | debug.dumpStackTraceFromBase(context, &stderr_bw); | |
| 272 | var stderr_fw = std.fs.File.stderr().writer(&.{}); | |
| 273 | const stderr = &stderr_fw.interface; | |
| 274 | debug.dumpStackTraceFromBase(context, stderr); | |
| 275 | 275 | }, |
| 276 | 276 | .not_supported => { |
| 277 | 277 | std.fs.File.stderr().writeAll("Stack trace not supported on this platform.\n") catch {}; |
| ... | ... | @@ -381,20 +381,20 @@ const PanicSwitch = struct { |
| 381 | 381 | |
| 382 | 382 | state.recover_stage = .release_mutex; |
| 383 | 383 | |
| 384 | var stderr_fw = std.fs.File.stderr().writer(); | |
| 385 | var stderr_bw = stderr_fw.interface().unbuffered(); | |
| 384 | var stderr_fw = std.fs.File.stderr().writer(&.{}); | |
| 385 | const stderr = &stderr_fw.interface; | |
| 386 | 386 | if (builtin.single_threaded) { |
| 387 | stderr_bw.print("panic: ", .{}) catch goTo(releaseMutex, .{state}); | |
| 387 | stderr.print("panic: ", .{}) catch goTo(releaseMutex, .{state}); | |
| 388 | 388 | } else { |
| 389 | 389 | const current_thread_id = std.Thread.getCurrentId(); |
| 390 | stderr_bw.print("thread {} panic: ", .{current_thread_id}) catch goTo(releaseMutex, .{state}); | |
| 390 | stderr.print("thread {} panic: ", .{current_thread_id}) catch goTo(releaseMutex, .{state}); | |
| 391 | 391 | } |
| 392 | stderr_bw.print("{s}\n", .{msg}) catch goTo(releaseMutex, .{state}); | |
| 392 | stderr.print("{s}\n", .{msg}) catch goTo(releaseMutex, .{state}); | |
| 393 | 393 | |
| 394 | 394 | state.recover_stage = .report_stack; |
| 395 | 395 | |
| 396 | 396 | dumpStatusReport() catch |err| { |
| 397 | stderr_bw.print("\nIntercepted error.{} while dumping current state. Continuing...\n", .{err}) catch {}; | |
| 397 | stderr.print("\nIntercepted error.{} while dumping current state. Continuing...\n", .{err}) catch {}; | |
| 398 | 398 | }; |
| 399 | 399 | |
| 400 | 400 | goTo(reportStack, .{state}); |
| ... | ... | @@ -409,9 +409,9 @@ const PanicSwitch = struct { |
| 409 | 409 | recover(state, trace, stack, msg); |
| 410 | 410 | |
| 411 | 411 | state.recover_stage = .release_mutex; |
| 412 | var stderr_fw = std.fs.File.stderr().writer(); | |
| 413 | var stderr_bw = stderr_fw.interface().unbuffered(); | |
| 414 | stderr_bw.writeAll("\nOriginal Error:\n") catch {}; | |
| 412 | var stderr_fw = std.fs.File.stderr().writer(&.{}); | |
| 413 | const stderr = &stderr_fw.interface; | |
| 414 | stderr.writeAll("\nOriginal Error:\n") catch {}; | |
| 415 | 415 | goTo(reportStack, .{state}); |
| 416 | 416 | } |
| 417 | 417 | |
| ... | ... | @@ -481,9 +481,9 @@ const PanicSwitch = struct { |
| 481 | 481 | recover(state, trace, stack, msg); |
| 482 | 482 | |
| 483 | 483 | state.recover_stage = .silent_abort; |
| 484 | var stderr_fw = std.fs.File.stderr().writer(); | |
| 485 | var stderr_bw = stderr_fw.interface().unbuffered(); | |
| 486 | stderr_bw.writeAll("Aborting...\n") catch {}; | |
| 484 | var stderr_fw = std.fs.File.stderr().writer(&.{}); | |
| 485 | const stderr = &stderr_fw.interface; | |
| 486 | stderr.writeAll("Aborting...\n") catch {}; | |
| 487 | 487 | goTo(abort, .{}); |
| 488 | 488 | } |
| 489 | 489 | |
| ... | ... | @@ -510,11 +510,11 @@ const PanicSwitch = struct { |
| 510 | 510 | // lower the verbosity, and restore it at the end if we don't panic. |
| 511 | 511 | state.recover_verbosity = .message_only; |
| 512 | 512 | |
| 513 | var stderr_fw = std.fs.File.stderr().writer(); | |
| 514 | var stderr_bw = stderr_fw.interface().unbuffered(); | |
| 515 | stderr_bw.writeAll("\nPanicked during a panic: ") catch {}; | |
| 516 | stderr_bw.writeAll(msg) catch {}; | |
| 517 | stderr_bw.writeAll("\nInner panic stack:\n") catch {}; | |
| 513 | var stderr_fw = std.fs.File.stderr().writer(&.{}); | |
| 514 | const stderr = &stderr_fw.interface; | |
| 515 | stderr.writeAll("\nPanicked during a panic: ") catch {}; | |
| 516 | stderr.writeAll(msg) catch {}; | |
| 517 | stderr.writeAll("\nInner panic stack:\n") catch {}; | |
| 518 | 518 | if (trace) |t| { |
| 519 | 519 | debug.dumpStackTrace(t.*); |
| 520 | 520 | } |
| ... | ... | @@ -525,11 +525,11 @@ const PanicSwitch = struct { |
| 525 | 525 | .message_only => { |
| 526 | 526 | state.recover_verbosity = .silent; |
| 527 | 527 | |
| 528 | var stderr_fw = std.fs.File.stderr().writer(); | |
| 529 | var stderr_bw = stderr_fw.interface().unbuffered(); | |
| 530 | stderr_bw.writeAll("\nPanicked while dumping inner panic stack: ") catch {}; | |
| 531 | stderr_bw.writeAll(msg) catch {}; | |
| 532 | stderr_bw.writeByte('\n') catch {}; | |
| 528 | var stderr_fw = std.fs.File.stderr().writer(&.{}); | |
| 529 | const stderr = &stderr_fw.interface; | |
| 530 | stderr.writeAll("\nPanicked while dumping inner panic stack: ") catch {}; | |
| 531 | stderr.writeAll(msg) catch {}; | |
| 532 | stderr.writeByte('\n') catch {}; | |
| 533 | 533 | |
| 534 | 534 | // If we succeed, restore all the way to dumping the stack. |
| 535 | 535 | state.recover_verbosity = .message_and_stack; |
src/link/SpirV.zig+3-3| ... | ... | @@ -206,7 +206,7 @@ pub fn flush( |
| 206 | 206 | var error_info: std.io.Writer.Allocating = .init(self.object.gpa); |
| 207 | 207 | defer error_info.deinit(); |
| 208 | 208 | |
| 209 | try error_info.interface.writeAll("zig_errors:"); | |
| 209 | try error_info.writer.writeAll("zig_errors:"); | |
| 210 | 210 | const ip = &self.base.comp.zcu.?.intern_pool; |
| 211 | 211 | for (ip.global_error_set.getNamesFromMainThread()) |name| { |
| 212 | 212 | // Errors can contain pretty much any character - to encode them in a string we must escape |
| ... | ... | @@ -214,9 +214,9 @@ pub fn flush( |
| 214 | 214 | // name if it contains no strange characters is nice for debugging. URI encoding fits the bill. |
| 215 | 215 | // We're using : as separator, which is a reserved character. |
| 216 | 216 | |
| 217 | try error_info.interface.writeByte(':'); | |
| 217 | try error_info.writer.writeByte(':'); | |
| 218 | 218 | try std.Uri.Component.percentEncode( |
| 219 | &error_info.interface, | |
| 219 | &error_info.writer, | |
| 220 | 220 | name.toSlice(ip), |
| 221 | 221 | struct { |
| 222 | 222 | fn isValidChar(c: u8) bool { |
src/print_zir.zig+13-13| ... | ... | @@ -42,7 +42,7 @@ pub fn renderAsText(gpa: Allocator, tree: ?Ast, zir: Zir, bw: *std.io.Writer) !v |
| 42 | 42 | |
| 43 | 43 | const import_path = zir.nullTerminatedString(item.data.name); |
| 44 | 44 | try bw.print(" @import(\"{f}\") ", .{ |
| 45 | std.zig.fmtEscapes(import_path), | |
| 45 | std.zig.fmtString(import_path), | |
| 46 | 46 | }); |
| 47 | 47 | try writer.writeSrcTokAbs(bw, item.data.token); |
| 48 | 48 | try bw.writeAll("\n"); |
| ... | ... | @@ -785,7 +785,7 @@ const Writer = struct { |
| 785 | 785 | ) Error!void { |
| 786 | 786 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].str; |
| 787 | 787 | const str = inst_data.get(self.code); |
| 788 | try stream.print("\"{f}\")", .{std.zig.fmtEscapes(str)}); | |
| 788 | try stream.print("\"{f}\")", .{std.zig.fmtString(str)}); | |
| 789 | 789 | } |
| 790 | 790 | |
| 791 | 791 | fn writeSliceStart(self: *Writer, stream: *std.io.Writer, inst: Zir.Inst.Index) !void { |
| ... | ... | @@ -942,7 +942,7 @@ const Writer = struct { |
| 942 | 942 | const extra = self.code.extraData(Zir.Inst.Param, inst_data.payload_index); |
| 943 | 943 | const body = self.code.bodySlice(extra.end, extra.data.type.body_len); |
| 944 | 944 | try stream.print("\"{f}\", ", .{ |
| 945 | std.zig.fmtEscapes(self.code.nullTerminatedString(extra.data.name)), | |
| 945 | std.zig.fmtString(self.code.nullTerminatedString(extra.data.name)), | |
| 946 | 946 | }); |
| 947 | 947 | |
| 948 | 948 | if (extra.data.type.is_generic) try stream.writeAll("[generic] "); |
| ... | ... | @@ -1212,7 +1212,7 @@ const Writer = struct { |
| 1212 | 1212 | try stream.writeAll(", "); |
| 1213 | 1213 | } else { |
| 1214 | 1214 | const asm_source = self.code.nullTerminatedString(extra.data.asm_source); |
| 1215 | try stream.print("\"{f}\", ", .{std.zig.fmtEscapes(asm_source)}); | |
| 1215 | try stream.print("\"{f}\", ", .{std.zig.fmtString(asm_source)}); | |
| 1216 | 1216 | } |
| 1217 | 1217 | try stream.writeAll(", "); |
| 1218 | 1218 | |
| ... | ... | @@ -1230,7 +1230,7 @@ const Writer = struct { |
| 1230 | 1230 | const name = self.code.nullTerminatedString(output.data.name); |
| 1231 | 1231 | const constraint = self.code.nullTerminatedString(output.data.constraint); |
| 1232 | 1232 | try stream.print("output({fp}, \"{f}\", ", .{ |
| 1233 | std.zig.fmtId(name), std.zig.fmtEscapes(constraint), | |
| 1233 | std.zig.fmtId(name), std.zig.fmtString(constraint), | |
| 1234 | 1234 | }); |
| 1235 | 1235 | try self.writeFlag(stream, "->", is_type); |
| 1236 | 1236 | try self.writeInstRef(stream, output.data.operand); |
| ... | ... | @@ -1249,7 +1249,7 @@ const Writer = struct { |
| 1249 | 1249 | const name = self.code.nullTerminatedString(input.data.name); |
| 1250 | 1250 | const constraint = self.code.nullTerminatedString(input.data.constraint); |
| 1251 | 1251 | try stream.print("input({fp}, \"{f}\", ", .{ |
| 1252 | std.zig.fmtId(name), std.zig.fmtEscapes(constraint), | |
| 1252 | std.zig.fmtId(name), std.zig.fmtString(constraint), | |
| 1253 | 1253 | }); |
| 1254 | 1254 | try self.writeInstRef(stream, input.data.operand); |
| 1255 | 1255 | try stream.writeAll(")"); |
| ... | ... | @@ -1308,7 +1308,7 @@ const Writer = struct { |
| 1308 | 1308 | .field => { |
| 1309 | 1309 | const field_name = self.code.nullTerminatedString(extra.data.field_name_start); |
| 1310 | 1310 | try self.writeInstRef(stream, extra.data.obj_ptr); |
| 1311 | try stream.print(", \"{f}\"", .{std.zig.fmtEscapes(field_name)}); | |
| 1311 | try stream.print(", \"{f}\"", .{std.zig.fmtString(field_name)}); | |
| 1312 | 1312 | }, |
| 1313 | 1313 | } |
| 1314 | 1314 | try stream.writeAll(", ["); |
| ... | ... | @@ -2212,7 +2212,7 @@ const Writer = struct { |
| 2212 | 2212 | const extra = self.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; |
| 2213 | 2213 | const name = self.code.nullTerminatedString(extra.field_name_start); |
| 2214 | 2214 | try self.writeInstRef(stream, extra.lhs); |
| 2215 | try stream.print(", \"{f}\") ", .{std.zig.fmtEscapes(name)}); | |
| 2215 | try stream.print(", \"{f}\") ", .{std.zig.fmtString(name)}); | |
| 2216 | 2216 | try self.writeSrcNode(stream, inst_data.src_node); |
| 2217 | 2217 | } |
| 2218 | 2218 | |
| ... | ... | @@ -2253,7 +2253,7 @@ const Writer = struct { |
| 2253 | 2253 | ) Error!void { |
| 2254 | 2254 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].str_tok; |
| 2255 | 2255 | const str = inst_data.get(self.code); |
| 2256 | try stream.print("\"{f}\") ", .{std.zig.fmtEscapes(str)}); | |
| 2256 | try stream.print("\"{f}\") ", .{std.zig.fmtString(str)}); | |
| 2257 | 2257 | try self.writeSrcTok(stream, inst_data.src_tok); |
| 2258 | 2258 | } |
| 2259 | 2259 | |
| ... | ... | @@ -2261,7 +2261,7 @@ const Writer = struct { |
| 2261 | 2261 | const inst_data = self.code.instructions.items(.data)[@intFromEnum(inst)].str_op; |
| 2262 | 2262 | const str = inst_data.getStr(self.code); |
| 2263 | 2263 | try self.writeInstRef(stream, inst_data.operand); |
| 2264 | try stream.print(", \"{f}\")", .{std.zig.fmtEscapes(str)}); | |
| 2264 | try stream.print(", \"{f}\")", .{std.zig.fmtString(str)}); | |
| 2265 | 2265 | } |
| 2266 | 2266 | |
| 2267 | 2267 | fn writeFunc( |
| ... | ... | @@ -2703,10 +2703,10 @@ const Writer = struct { |
| 2703 | 2703 | try self.writeInstIndex(stream, ptr_inst); |
| 2704 | 2704 | }, |
| 2705 | 2705 | .decl_val => |str| try stream.print("decl_val \"{f}\"", .{ |
| 2706 | std.zig.fmtEscapes(self.code.nullTerminatedString(str)), | |
| 2706 | std.zig.fmtString(self.code.nullTerminatedString(str)), | |
| 2707 | 2707 | }), |
| 2708 | 2708 | .decl_ref => |str| try stream.print("decl_ref \"{f}\"", .{ |
| 2709 | std.zig.fmtEscapes(self.code.nullTerminatedString(str)), | |
| 2709 | std.zig.fmtString(self.code.nullTerminatedString(str)), | |
| 2710 | 2710 | }), |
| 2711 | 2711 | } |
| 2712 | 2712 | } |
| ... | ... | @@ -2839,7 +2839,7 @@ const Writer = struct { |
| 2839 | 2839 | const extra = self.code.extraData(Zir.Inst.Import, inst_data.payload_index).data; |
| 2840 | 2840 | try self.writeInstRef(stream, extra.res_ty); |
| 2841 | 2841 | const import_path = self.code.nullTerminatedString(extra.path); |
| 2842 | try stream.print(", \"{f}\") ", .{std.zig.fmtEscapes(import_path)}); | |
| 2842 | try stream.print(", \"{f}\") ", .{std.zig.fmtString(import_path)}); | |
| 2843 | 2843 | try self.writeSrcTok(stream, inst_data.src_tok); |
| 2844 | 2844 | } |
| 2845 | 2845 | }; |
src/print_zoir.zig+3-3| ... | ... | @@ -72,8 +72,8 @@ const PrintZon = struct { |
| 72 | 72 | }, |
| 73 | 73 | .float_literal => |x| try pz.w.print("float({d})", .{x}), |
| 74 | 74 | .char_literal => |x| try pz.w.print("char({d})", .{x}), |
| 75 | .enum_literal => |x| try pz.w.print("enum_literal({fp})", .{std.zig.fmtId(x.get(zoir))}), | |
| 76 | .string_literal => |x| try pz.w.print("str(\"{f}\")", .{std.zig.fmtEscapes(x)}), | |
| 75 | .enum_literal => |x| try pz.w.print("enum_literal({f})", .{std.zig.fmtIdP(x.get(zoir))}), | |
| 76 | .string_literal => |x| try pz.w.print("str(\"{f}\")", .{std.zig.fmtString(x)}), | |
| 77 | 77 | .empty_literal => try pz.w.writeAll("empty_literal(.{})"), |
| 78 | 78 | .array_literal => |vals| { |
| 79 | 79 | try pz.w.writeAll("array_literal({"); |
| ... | ... | @@ -92,7 +92,7 @@ const PrintZon = struct { |
| 92 | 92 | pz.indent += 1; |
| 93 | 93 | for (s.names, 0..s.vals.len) |name, idx| { |
| 94 | 94 | try pz.newline(); |
| 95 | try pz.w.print("[{fp}] ", .{std.zig.fmtId(name.get(zoir))}); | |
| 95 | try pz.w.print("[{f}] ", .{std.zig.fmtIdP(name.get(zoir))}); | |
| 96 | 96 | try pz.renderNode(s.vals.at(@intCast(idx))); |
| 97 | 97 | try pz.w.writeByte(','); |
| 98 | 98 | } |