Fix inline stacks

This commit is contained in:
Simon Gellis 2025-10-25 10:03:57 -04:00
parent c00fae79f8
commit 8dd64598ed
1 changed files with 5 additions and 0 deletions

View File

@ -60,6 +60,11 @@ impl ProgramState {
let Some(stack) = self.call_stacks.get_mut(code) else { let Some(stack) = self.call_stacks.get_mut(code) else {
bail!("missing stack {code:04x}"); bail!("missing stack {code:04x}");
}; };
// just popping the inline frames first
while stack
.pop_if(|f| matches!(f, StackFrame::Label(_)))
.is_some()
{}
if stack.pop().is_none() { if stack.pop().is_none() {
bail!("returned from {code:04x} but stack was empty"); bail!("returned from {code:04x} but stack was empty");
} }