Merge pull request 'fix: mutate.test.ts: pre-existing isValid > stack underflow failure (#810)' (#848) from fix/issue-810 into master

This commit is contained in:
johba 2026-03-16 01:09:20 +01:00
commit 3e5cbea7f7

View file

@ -31,15 +31,13 @@ function emit(state: TranspilerState, line: string): void {
function dpop(state: TranspilerState, ctx: string): string {
const v = state.dStack.pop();
// Stack underflow → Push3 no-op semantics: treat missing value as 0
if (v === undefined) return '0';
if (v === undefined) throw new Error(`DYADIC stack underflow at ${ctx}`);
return v;
}
function bpop(state: TranspilerState, ctx: string): string {
const v = state.bStack.pop();
// Stack underflow → Push3 no-op semantics: treat missing bool as false
if (v === undefined) return 'false';
if (v === undefined) throw new Error(`BOOLEAN stack underflow at ${ctx}`);
return v;
}