Files
ladybird/Tests/LibJS/Bytecode/input/block-scoped-function-no-tdz.js
Andreas Kling cd2576c031 LibJS: Mark block-scoped function declaration locals as initialized
When emitting block declaration instantiation, we were not calling
set_local_initialized() after writing block-scoped function
declarations to local variables via Mov. This caused unnecessary
ThrowIfTDZ checks to be emitted when those locals were later read.

Block-scoped function declarations are always initialized at block
entry (via NewFunction + Mov), so TDZ checks for them are redundant.
2026-02-19 02:45:37 +01:00

11 lines
151 B
JavaScript

"use strict";
function test() {
let result;
{
function foo() { return 42; }
result = foo();
}
return result;
}
test();