mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-16 07:11:52 +00:00
LibJS: Improve function hoisting across blocks
The parser now keeps track of a scope chain so that it can hoist function declarations to the closest function scope.
This commit is contained in:
parent
72f8d90dc5
commit
38fd980b0c
Notes:
sideshowbarker
2024-07-18 10:20:15 +09:00
Author: https://github.com/Hendi48
Commit: 38fd980b0c
Pull-request: https://github.com/SerenityOS/serenity/pull/8439
Issue: https://github.com/SerenityOS/serenity/issues/8299
Reviewed-by: https://github.com/linusg ✅
6 changed files with 79 additions and 22 deletions
|
@ -8,7 +8,7 @@ test("basic functionality", () => {
|
|||
});
|
||||
|
||||
// First two calls produce a ReferenceError, but the declarations should be hoisted
|
||||
test.skip("functions are hoisted across non-lexical scopes", () => {
|
||||
test("functions are hoisted across non-lexical scopes", () => {
|
||||
expect(scopedHoisted).toBeUndefined();
|
||||
expect(callScopedHoisted).toBeUndefined();
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue