| ... | @@ -2477,6 +2477,18 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2477,6 +2477,18 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2477 | assert(file.zir_loaded); | 2477 | assert(file.zir_loaded); |
| 2478 | const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst)); | 2478 | const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst)); |
| 2479 | assert(decl_inst.tag == .declaration); | 2479 | assert(decl_inst.tag == .declaration); |
| | 2480 | const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index); |
| | 2481 | |
| | 2482 | const is_test = switch (decl_extra.data.name) { |
| | 2483 | .unnamed_test, .decltest => true, |
| | 2484 | .@"comptime", .@"usingnamespace" => false, |
| | 2485 | _ => decl_extra.data.name.isNamedTest(file.zir), |
| | 2486 | }; |
| | 2487 | if (is_test) { |
| | 2488 | // This isn't actually a comptime Nav! It's a test, so it'll definitely never be referenced at comptime. |
| | 2489 | return; |
| | 2490 | } |
| | 2491 | |
| 2480 | const tree = try file.getTree(dwarf.gpa); | 2492 | const tree = try file.getTree(dwarf.gpa); |
| 2481 | const loc = tree.tokenLocation(0, tree.nodes.items(.main_token)[decl_inst.data.declaration.src_node]); | 2493 | const loc = tree.tokenLocation(0, tree.nodes.items(.main_token)[decl_inst.data.declaration.src_node]); |
| 2482 | assert(loc.line == zcu.navSrcLine(nav_index)); | 2494 | assert(loc.line == zcu.navSrcLine(nav_index)); |
| ... | @@ -2582,7 +2594,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2582,7 +2594,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2582 | if (loaded_struct.zir_index == .none) break :decl_struct; | 2594 | if (loaded_struct.zir_index == .none) break :decl_struct; |
| 2583 | | 2595 | |
| 2584 | const value_inst = value_inst: { | 2596 | const value_inst = value_inst: { |
| 2585 | const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index); | | |
| 2586 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; | 2597 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; |
| 2587 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); | 2598 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); |
| 2588 | if (break_inst.tag != .break_inline) break :value_inst null; | 2599 | if (break_inst.tag != .break_inline) break :value_inst null; |
| ... | @@ -2704,7 +2715,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2704,7 +2715,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2704 | if (loaded_enum.zir_index == .none) break :decl_enum; | 2715 | if (loaded_enum.zir_index == .none) break :decl_enum; |
| 2705 | | 2716 | |
| 2706 | const value_inst = value_inst: { | 2717 | const value_inst = value_inst: { |
| 2707 | const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index); | | |
| 2708 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; | 2718 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; |
| 2709 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); | 2719 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); |
| 2710 | if (break_inst.tag != .break_inline) break :value_inst null; | 2720 | if (break_inst.tag != .break_inline) break :value_inst null; |
| ... | @@ -2788,7 +2798,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2788,7 +2798,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2788 | | 2798 | |
| 2789 | decl_union: { | 2799 | decl_union: { |
| 2790 | const value_inst = value_inst: { | 2800 | const value_inst = value_inst: { |
| 2791 | const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index); | | |
| 2792 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; | 2801 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; |
| 2793 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); | 2802 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); |
| 2794 | if (break_inst.tag != .break_inline) break :value_inst null; | 2803 | if (break_inst.tag != .break_inline) break :value_inst null; |
| ... | @@ -2911,7 +2920,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool | ... | @@ -2911,7 +2920,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2911 | | 2920 | |
| 2912 | decl_opaque: { | 2921 | decl_opaque: { |
| 2913 | const value_inst = value_inst: { | 2922 | const value_inst = value_inst: { |
| 2914 | const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index); | | |
| 2915 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; | 2923 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; |
| 2916 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); | 2924 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); |
| 2917 | if (break_inst.tag != .break_inline) break :value_inst null; | 2925 | if (break_inst.tag != .break_inline) break :value_inst null; |