1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:08:12 +00:00

LibJS: Restructure and fully implement BindingPatterns

This commit is contained in:
Matthew Olsson 2021-06-12 18:04:28 -07:00 committed by Andreas Kling
parent 10372b8118
commit ce04c2259f
9 changed files with 244 additions and 169 deletions

View file

@ -100,7 +100,7 @@ LexicalEnvironment* ScriptFunction::create_environment()
parameter.binding.visit(
[&](const FlyString& name) { variables.set(name, { js_undefined(), DeclarationKind::Var }); },
[&](const NonnullRefPtr<BindingPattern>& binding) {
binding->for_each_assigned_name([&](const auto& name) {
binding->for_each_bound_name([&](const auto& name) {
variables.set(name, { js_undefined(), DeclarationKind::Var });
});
});
@ -114,7 +114,7 @@ LexicalEnvironment* ScriptFunction::create_environment()
variables.set(id->string(), { js_undefined(), declaration.declaration_kind() });
},
[&](const NonnullRefPtr<BindingPattern>& binding) {
binding->for_each_assigned_name([&](const auto& name) {
binding->for_each_bound_name([&](const auto& name) {
variables.set(name, { js_undefined(), declaration.declaration_kind() });
});
});