Files
bun.sh/test/regression
Claude Bot e1afd658c7 fix(parser): function declarations inside labeled statements should hoist in sloppy mode
Per ECMAScript Annex B, function declarations inside labeled statements
in sloppy mode should hoist like regular function declarations, not like
block-scoped functions.

Previously, Bun incorrectly transformed:
```js
foo:
    function bar() { return "bar"; }
console.log(bar()); // ReferenceError: bar is not defined
```

Into:
```js
foo: {
  let bar = function() { return "bar"; };
}
console.log(bar()); // bar is undefined outside the block
```

Now the function declaration is preserved as-is, matching Node.js/V8 behavior.

Fixes #25737

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 12:20:47 +00:00
..