LibJS: Respect declaration kind for variables inside functions

This commit is contained in:
speles 2021-02-26 00:20:09 +02:00 committed by Andreas Kling
parent 65e083ed36
commit 913fd8de13
Notes: sideshowbarker 2024-07-18 21:54:35 +09:00

View file

@ -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() });
}
}
}