╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ IncrementalDebugServer.zig ───────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
392 return .wrap(.{ .type_layout = @fromBackingInt(@intCast(parseIndex(idx_str) orelse return null)) }); 393 } else if (std.mem.eql(u8, kind, "struct_defaults")) { 394 return .wrap(.{ .struct_defaults = @fromBackingInt(@intCast(parseIndex(idx_str) orelse return null)) }); 395 } else if (std.mem.eql(u8, kind, "func")) { 396 return .wrap(.{ .func = @fromBackingInt(@intCast(parseIndex(idx_str) orelse return null)) }); 397 } else if (std.mem.eql(u8, kind, "memoized_state")) { 398 return .wrap(.{ .memoized_state = std.meta.stringToEnum( 399 InternPool.MemoizedStateStage, 400 idx_str, 401 ) orelse return null }); 402 } else { 403 return null; 404 } 405 } 406 fn printAnalUnit(unit: AnalUnit, buf: *[32]u8) []const u8 { 407 const idx: u32 = switch (unit.unwrap()) { 408 .memoized_state => |stage| return std.mem.print(buf, "memoized_state {s}", .{@tagName(stage)}) catch unreachable, 409 inline else => |i| @backingInt(i), 410 }; 411 return std.mem.print(buf, "{s} {d}", .{ @tagName(unit.unwrap()), idx }) catch unreachable; 412 } 413 414 fn printType(ty: Type, zcu: *const Zcu, w: *Io.Writer) Io.Writer.Error!void { 415 const ip = &zcu.intern_pool; 416 switch (ip.indexToKey(ty.toIntern())) { 417 .int_type => |int| try w.print("{c}{d}", .{ 418 @as(u8, if (int.signedness == .unsigned) 'u' else 'i'), 419 int.bits, 420 }), 421 .tuple_type => try w.writeAll("(tuple)"), 422 .error_set_type => try w.writeAll("(error set)"), 423 .inferred_error_set_type => try w.writeAll("(inferred error set)"), 424 .func_type => try w.writeAll("(function)"), 425 .anyframe_type => try w.writeAll("(anyframe)"), 426 .vector_type => { 427 try w.print("@Vector({d}, ", .{ty.vectorLen(zcu)}); 428 try printType(ty.childType(zcu), zcu, w); 429 try w.writeByte(')'); 430 }, 431 .array_type => { 432 try w.print("[{d}]", .{ty.arrayLen(zcu)}); 433 try printType(ty.childType(zcu), zcu, w); 434 }, 435 .opt_type => { 436 try w.writeByte('?'); 437 try printType(ty.optionalChild(zcu), zcu, w); 438 }, 439 .error_union_type => { 440 try printType(ty.errorUnionSet(zcu), zcu, w); 441 try w.writeByte('!'); 442 try printType(ty.errorUnionPayload(zcu), zcu, w); 443 }, 444 .ptr_type => { 445 try w.writeAll("*(attrs) "); 446 try printType(ty.childType(zcu), zcu, w); 447 }, 448 .simple_type => |simple| try w.writeAll(@tagName(simple)), 449 450 .struct_type, 451 .union_type, 452 .enum_type, 453 .opaque_type, 454 => try w.print("{f}[{d}]", .{ ty.containerTypeName(ip).fqn.fmt(ip), @backingInt(ty.toIntern()) }), 455 456 else => unreachable, 457 } 458 } 459 460 const std = @import("std"); 461 const Io = std.Io; 462 const Allocator = std.mem.Allocator; 463 const log = std.log.scoped(.incremental_debug_server); 464 465 const Compilation = @import("Compilation.zig"); 466 const Zcu = @import("Zcu.zig"); 467 const InternPool = @import("InternPool.zig"); 468 const Type = @import("Type.zig"); 469 const AnalUnit = InternPool.AnalUnit; 470 471 const IncrementalDebugServer = @This(); 472