Normalize passes keep spans and clean warnings
This commit is contained in:
@ -158,8 +158,8 @@ impl MirPrinter {
|
||||
let mut barrier_read = 0usize;
|
||||
let mut barrier_write = 0usize;
|
||||
for block in function.blocks.values() {
|
||||
for inst in &block.instructions {
|
||||
match inst {
|
||||
for sp in block.iter_spanned() {
|
||||
match sp.inst {
|
||||
MirInstruction::Throw { .. } => {
|
||||
if dlog::on("NYASH_DEBUG_MIR_PRINTER") {
|
||||
eprintln!("[PRINTER] found throw in {}", function.signature.name);
|
||||
@ -191,8 +191,8 @@ impl MirPrinter {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
if let Some(term) = &block.terminator {
|
||||
match term {
|
||||
if let Some(sp) = block.terminator_spanned() {
|
||||
match sp.inst {
|
||||
MirInstruction::Throw { .. } => {
|
||||
if dlog::on("NYASH_DEBUG_MIR_PRINTER") {
|
||||
eprintln!(
|
||||
@ -306,17 +306,16 @@ impl MirPrinter {
|
||||
writeln!(output).unwrap();
|
||||
|
||||
// Instructions
|
||||
let mut line_num = 0;
|
||||
for instruction in block.all_instructions() {
|
||||
for sp in block.all_spanned_instructions() {
|
||||
if self.show_line_numbers {
|
||||
write!(output, " {:3}: ", line_num).unwrap();
|
||||
write!(output, " {:3}: ", sp.span.line).unwrap();
|
||||
} else {
|
||||
write!(output, " ").unwrap();
|
||||
}
|
||||
|
||||
let mut line = self.format_instruction(instruction, types);
|
||||
let mut line = self.format_instruction(sp.inst, types);
|
||||
if self.show_effects_inline {
|
||||
let eff = instruction.effects();
|
||||
let eff = sp.inst.effects();
|
||||
let cat = if eff.is_pure() {
|
||||
"pure"
|
||||
} else if eff.is_read_only() {
|
||||
@ -327,7 +326,6 @@ impl MirPrinter {
|
||||
line.push_str(&format!(" ; eff: {}", cat));
|
||||
}
|
||||
writeln!(output, "{}", line).unwrap();
|
||||
line_num += 1;
|
||||
}
|
||||
|
||||
// Block effects (if verbose and not pure)
|
||||
|
||||
Reference in New Issue
Block a user