summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime
diff options
context:
space:
mode:
authorspeles <speles@mail.ua>2021-02-26 00:20:09 +0200
committerAndreas Kling <kling@serenityos.org>2021-02-26 16:59:37 +0100
commit913fd8de13c5cab4f7ab63e84c54de570701e60c (patch)
tree3989b6b4e128c8b7b07b7a67c889ea6290b8b5de /Userland/Libraries/LibJS/Runtime
parent65e083ed36c6b2c8baa5d2b5957ba8ec5f7ee29e (diff)
downloadserenity-913fd8de13c5cab4f7ab63e84c54de570701e60c.zip
LibJS: Respect declaration kind for variables inside functions
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp b/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp
index 56ce94edd2..87eeb2d040 100644
--- a/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ScriptFunction.cpp
@@ -97,7 +97,7 @@ LexicalEnvironment* ScriptFunction::create_environment()
if (is<ScopeNode>(body())) {
for (auto& declaration : static_cast<const ScopeNode&>(body()).variables()) {
for (auto& declarator : declaration.declarations()) {
- variables.set(declarator.id().string(), { js_undefined(), DeclarationKind::Var });
+ variables.set(declarator.id().string(), { js_undefined(), declaration.declaration_kind() });
}
}
}