diff --git a/ablescript/src/interpret.rs b/ablescript/src/interpret.rs index 7d314be..986c46a 100644 --- a/ablescript/src/interpret.rs +++ b/ablescript/src/interpret.rs @@ -129,10 +129,12 @@ impl ExecEnv { }), }?; - for block in std::mem::take(&mut self.finalisers) { - self.eval_stmts_hs(&block, true)?; + while self.finalisers.len() != 0 { + for block in std::mem::take(&mut self.finalisers) { + self.eval_stmts_hs(&block, true)?; + } } - + Ok(()) }