From c0ef5f55eb13542ec5c9d1d2d6af394ae07b1992 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sun, 5 Oct 2025 20:26:21 -0700 Subject: [PATCH] no continue --- SPEC.md | 3 +-- src/frame.ts | 1 - src/vm.ts | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/SPEC.md b/SPEC.md index c6946b4..30e2769 100644 --- a/SPEC.md +++ b/SPEC.md @@ -100,7 +100,6 @@ type CallFrame = { returnAddress: number // Where to resume after RETURN returnScope: Scope // Scope to restore after RETURN isBreakTarget: boolean // Can be targeted by BREAK - continueAddress?: number // Where to jump for CONTINUE } ``` @@ -602,7 +601,7 @@ All of these should throw errors: ### Break/Continue Semantics - BREAK unwinds to frame that called the iterator function - Multiple nested function calls: break exits all of them until reaching marked frame -- CONTINUE requires explicit continueAddress in frame (set by compiler for loops) +- CONTINUE is implemented by the compiler using JUMPs ### Exception Unwinding - THROW unwinds call stack to handler's depth, not just to handler diff --git a/src/frame.ts b/src/frame.ts index cf89b3b..1f9ec23 100644 --- a/src/frame.ts +++ b/src/frame.ts @@ -4,5 +4,4 @@ export type Frame = { returnAddress: number returnScope: Scope isBreakTarget: boolean - continueAddress?: number } \ No newline at end of file diff --git a/src/vm.ts b/src/vm.ts index 7f31673..8bf05c9 100644 --- a/src/vm.ts +++ b/src/vm.ts @@ -350,8 +350,7 @@ export class VM { this.callStack.push({ returnAddress: this.pc, returnScope: this.scope, - isBreakTarget: false, - continueAddress: undefined + isBreakTarget: false }) this.scope = new Scope(fn.parentScope)