summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/AST.cpp
diff options
context:
space:
mode:
authorHendi <hendi48@users.noreply.github.com>2021-07-05 21:45:34 +0200
committerLinus Groh <mail@linusgroh.de>2021-07-06 00:15:37 +0100
commit3411d50737725b382ae526e91a8bbd60656c3323 (patch)
treede589cc7b9cc9b85d102ae4ed45dd5974a2b2bf9 /Userland/Libraries/LibJS/AST.cpp
parentc194afd17c501195a7598e4f07c8f040d0d66221 (diff)
downloadserenity-3411d50737725b382ae526e91a8bbd60656c3323.zip
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).
Diffstat (limited to 'Userland/Libraries/LibJS/AST.cpp')
-rw-r--r--Userland/Libraries/LibJS/AST.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp
index 23b16fb21b..db0485caf0 100644
--- a/Userland/Libraries/LibJS/AST.cpp
+++ b/Userland/Libraries/LibJS/AST.cpp
@@ -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);
}
}