1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +00:00

LibJS: Don't hoist functions under certain circumstances

When a lexical declaration with the same name as a function exists,
the function is not hoisted (annex B).
This commit is contained in:
Hendi 2021-07-05 21:45:34 +02:00 committed by Linus Groh
parent e0d26fff8c
commit 37c4fbb6ca
4 changed files with 50 additions and 9 deletions

View file

@ -145,7 +145,7 @@ public:
void add_variables(NonnullRefPtrVector<VariableDeclaration>);
void add_functions(NonnullRefPtrVector<FunctionDeclaration>);
void add_hoisted_functions(NonnullRefPtrVector<FunctionDeclaration>);
void add_hoisted_function(NonnullRefPtr<FunctionDeclaration>);
NonnullRefPtrVector<VariableDeclaration> const& variables() const { return m_variables; }
NonnullRefPtrVector<FunctionDeclaration> const& functions() const { return m_functions; }
NonnullRefPtrVector<FunctionDeclaration> const& hoisted_functions() const { return m_hoisted_functions; }