| author | |
| committer | |
| log | 67665286575d406769000b3f3e80d4d03d2cab2b |
| tree | 7cdd00995419c5ced2b1e558975cceca8d76635c |
| parent | 69e6d455ce8e21835ec3ce268a0533e0e7666e8b |
Example scenario:
test {
const a: i32 = blk: {
if (false) break :blk 24;
};
_ = a;
}
Prior to this, this would panic the compiler with a source needed error.
This provides the source as `sema.src`. This is not ideal, since the
line it points to is pretty far from the true issue. (One block out)
But, this prevents the compiler from straight up crashing and follows a
pattern used by similar ZIR which don't provide a src loc.1 files changed, 1 insertions(+), 1 deletions(-)
src/Sema.zig+1-1| ... | ... | @@ -6362,7 +6362,7 @@ fn zirAs(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst |
| 6362 | 6362 | defer tracy.end(); |
| 6363 | 6363 | |
| 6364 | 6364 | const bin_inst = sema.code.instructions.items(.data)[inst].bin; |
| 6365 | return sema.analyzeAs(block, .unneeded, bin_inst.lhs, bin_inst.rhs); | |
| 6365 | return sema.analyzeAs(block, sema.src, bin_inst.lhs, bin_inst.rhs); | |
| 6366 | 6366 | } |
| 6367 | 6367 | |
| 6368 | 6368 | fn zirAsNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |