You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Closure in a block can't see a binding declared later in the same block (ReferenceError) #11778
Inside a plain { } block, a closure that refers to a const/let/class declared later in the same block throws a ReferenceError when it runs after that declaration. Node runs it fine. The same code at top level works in perry.
{constf=()=>g;constg=5;console.log(f());// node: 5 perry: ReferenceError: g is not defined}
It's the same with a class declared later in the block ({ const f = () => new SC(); class SC {} f(); } gives ReferenceError: SC is not defined). This was found while working on #11777 and reproduces on main before that change (6a61c2ceff), so it's not caused by #11777. It looks related to closed #6523. Probes are in secret-tests scratchpad/class-super/fw2.ts and fw3.ts.
Activity
fix(hir): preserve block forward captures (Closes #11778)