1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:05:07 +00:00

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

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