Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: local variables cleared in case of runtime errors #207

Closed
sharkdp opened this issue Oct 11, 2023 · 0 comments
Closed

Regression: local variables cleared in case of runtime errors #207

sharkdp opened this issue Oct 11, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@sharkdp
Copy link
Owner

sharkdp commented Oct 11, 2023

>>> let x = 1

  let x: Scalar = 1

>>> 1/0
error: runtime error
 = Division by zero

>>> x
thread 'main' panicked at numbat/src/vm.rs:567:41:
index out of bounds: the len is 0 but the index is 79
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This is because we now keep local variables on the stack (since #197), and we clear the stack when encountering a runtime error here:

self.stack.clear();

@sharkdp sharkdp added the bug Something isn't working label Oct 11, 2023
sharkdp added a commit to eminence/numbat that referenced this issue Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant