We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7a6000d commit f4b5408Copy full SHA for f4b5408
vm/src/frame.rs
@@ -607,7 +607,15 @@ impl ExecutingFrame<'_> {
607
Ok(None)
608
}
609
bytecode::Instruction::DeleteFast(idx) => {
610
- self.fastlocals.lock()[idx.get(arg) as usize] = None;
+ let mut fastlocals = self.fastlocals.lock();
611
+ let idx = idx.get(arg) as usize;
612
+ if fastlocals[idx].is_none() {
613
+ return Err(vm.new_exception_msg(
614
+ vm.ctx.exceptions.unbound_local_error.to_owned(),
615
+ format!("local variable '{}' referenced before assignment", self.code.varnames[idx]),
616
+ ));
617
+ }
618
+ fastlocals[idx] = None;
619
620
621
bytecode::Instruction::DeleteLocal(idx) => {
0 commit comments