diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-24 11:16:10 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-24 11:16:10 +0300 |
| commit | d35efdcdde0b6985473684f0b5668950a8477703 (patch) | |
| tree | 107da3fcdee51e5bbedf8cc9871fcbf9ff35eeca /docs/basic-arithmetic.md | |
| parent | 065dd252af1d2f1c70f8929058ea364481ab0658 (diff) | |
fix: restore RPN stack on ParseAndEvaluate error in RPNHandler
RPNHandler.Handle silently swallowed ParseAndEvaluate errors on
multi-word input, leaving the persistent REPL stack in a corrupted
state. evaluate() modifies r.currentStack directly during token
processing, so partial evaluation on failure left orphan values.
Fix: save the stack before ParseAndEvaluate, restore it on error.
Applied to both the bare RPN path and the rpn/calc prefix path.
Added tests:
- TestRPNHandlerStackNotCorruptedOnError (bare multi-word input)
- TestRPNHandlerErrorReturnedNotSwallowed (error propagation)
- TestRPNHandlerStackNotCorruptedOnPrefixedError (rpn/calc prefix)
Diffstat (limited to 'docs/basic-arithmetic.md')
0 files changed, 0 insertions, 0 deletions
