Files
akbasic/tests
Andrew Kesterson 48f650c3af Stop an armed TRAP from swallowing parse errors whole
A program with TRAP set and a line that would not parse printed nothing at all
and exited zero. No error line, because akbasic_runtime_error() intercepts for
the trap and deliberately prints nothing; and no handler, because the parse
branch of process_line_run() then set run_finished_mode regardless -- QUIT for a
file -- so the next line boundary the handler would have been entered at never
came. Arming an error handler made errors disappear.

The guard is to set the finished mode only when the error was actually reported.
The runtime path was always right: report_and_reraise() never touched the mode.

The same branch also never recorded the status, so the handler that now runs was
handed ER# 0. It sets lasterrorstatus from the context the way
report_and_reraise() does, and a trapped SCALE with no arguments reports 512.

Found while writing the error-code appendix -- documenting what ER# can hold
means provoking each code, and this is what happened on the way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 07:36:00 -04:00
..