1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +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 c194afd17c
commit 3411d50737
4 changed files with 45 additions and 8 deletions

View file

@ -2377,9 +2377,9 @@ void ScopeNode::add_functions(NonnullRefPtrVector<FunctionDeclaration> functions
m_functions.extend(move(functions));
}
void ScopeNode::add_hoisted_functions(NonnullRefPtrVector<FunctionDeclaration> hoisted_functions)
void ScopeNode::add_hoisted_function(NonnullRefPtr<FunctionDeclaration> hoisted_function)
{
m_hoisted_functions.extend(move(hoisted_functions));
m_hoisted_functions.append(hoisted_function);
}
}