Skip to content

Commit

Permalink
fix a repl crash
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Mar 26, 2024
1 parent bf954c4 commit d9d976a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/compile/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,11 @@ impl Compiler {
let val = val.clone();
self.asm.instrs.pop();
self.asm.bind_const(local, Some(val), span_index, comment);
let last_slice = self.asm.top_slices.last_mut().unwrap();
last_slice.len -= 1;
if last_slice.len == 0 {
self.asm.top_slices.pop();
if let Some(last_slice) = self.asm.top_slices.last_mut() {
last_slice.len -= 1;
if last_slice.len == 0 {
self.asm.top_slices.pop();
}
}
} else {
self.asm.bind_const(local, None, span_index, comment);
Expand Down

0 comments on commit d9d976a

Please sign in to comment.