diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/compiler.rs | 9 | ||||
| -rw-r--r-- | src/vm.rs | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler.rs b/src/compiler.rs index 4bb2469..0dfa1a3 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -415,7 +415,14 @@ impl Compiler { expect!(self, Token::Comma, "Expect ',' between initalizer and loop expression."); let inc = block.curr(); - self.statement(block); + { + let h = self.stack.len(); + self.statement(block); + for _ in h..self.stack.len() { + block.add(Op::Pop, self.line()); + } + self.stack.truncate(h); + } block.add(Op::Jmp(cond), self.line()); // patch_jmp!(Op::Jmp, cond_cont => block.curr()); @@ -153,7 +153,7 @@ impl VM { } pub fn run(&mut self) -> Result<(), Error>{ - const PRINT_WHILE_RUNNING: bool = true; + const PRINT_WHILE_RUNNING: bool = false; const PRINT_BLOCK: bool = true; if PRINT_BLOCK { |
