1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

LibJS: Remove the non-standard put helper and replace it's usages

This removes all usages of the non-standard put helper method and
replaces all of it's usages with the specification required alternative
or with define_direct_property where appropriate.
This commit is contained in:
Idan Horowitz 2021-07-06 01:15:50 +03:00 committed by Linus Groh
parent 53f70e5208
commit e3ef241108
15 changed files with 40 additions and 49 deletions

View file

@ -110,11 +110,11 @@ void Interpreter::enter_scope(const ScopeNode& scope_node, ScopeType scope_type,
if (is_program_node && declaration.declaration_kind() == DeclarationKind::Var) {
declarator.target().visit(
[&](const NonnullRefPtr<Identifier>& id) {
global_object.put(id->string(), js_undefined());
global_object.define_direct_property(id->string(), js_undefined(), JS::Attribute::Writable | JS::Attribute::Enumerable);
},
[&](const NonnullRefPtr<BindingPattern>& binding) {
binding->for_each_bound_name([&](const auto& name) {
global_object.put(name, js_undefined());
global_object.define_direct_property(name, js_undefined(), JS::Attribute::Writable | JS::Attribute::Enumerable);
});
});
if (exception())