mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-09 16:42:19 +02:00
Each of the three blocks in a TryStatement (try body, catch body, finally body) needs its own CompletionRegisterScope so that break/continue inside any of them carries the block's own completion value rather than leaking a value from a surrounding statement or a different block. Previously, statements inside these blocks would update the enclosing scope's completion register (e.g. a for-loop's register), and if break/continue fired with no prior expression value, the enclosing register's stale value would leak through as the completion value instead of undefined. Each block now allocates a fresh register initialized to undefined and uses it as the current completion register during body generation. This matches the pattern already used by loops and switch statements.
187 KiB
187 KiB