Normalize passes keep spans and clean warnings
This commit is contained in:
@ -148,9 +148,9 @@ impl MirInterpreter {
|
||||
) -> Option<crate::ast::Span> {
|
||||
let idx = inst_index?;
|
||||
if idx < block.instructions.len() {
|
||||
block.instruction_span(idx)
|
||||
block.instruction_with_span(idx).map(|sp| sp.span)
|
||||
} else if idx == block.instructions.len() {
|
||||
block.terminator_span()
|
||||
block.terminator_spanned().map(|sp| sp.span)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@ -334,9 +334,10 @@ impl MirInterpreter {
|
||||
|
||||
fn execute_block_instructions(&mut self, block: &BasicBlock) -> Result<(), VMError> {
|
||||
let phi_count = block.phi_instructions().count();
|
||||
for (idx, inst) in block.non_phi_instructions().enumerate() {
|
||||
for (idx, sp) in block.iter_spanned_enumerated().skip(phi_count) {
|
||||
let inst = sp.inst;
|
||||
self.last_block = Some(block.id);
|
||||
self.last_inst_index = Some(phi_count + idx);
|
||||
self.last_inst_index = Some(idx);
|
||||
self.last_inst = Some(inst.clone());
|
||||
if Self::trace_enabled() {
|
||||
eprintln!("[vm-trace] inst bb={:?} {:?}", block.id, inst);
|
||||
|
||||
Reference in New Issue
Block a user