1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +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

@ -73,10 +73,10 @@ Value GeneratorObject::next_impl(VM& vm, GlobalObject& global_object, Optional<V
return {};
auto result = Object::create(global_object, global_object.object_prototype());
result->put("value", previous_generated_value);
result->define_direct_property("value", previous_generated_value, JS::default_attributes);
if (m_done) {
result->put("done", Value(true));
result->define_direct_property("done", Value(true), JS::default_attributes);
return result;
}
@ -88,7 +88,7 @@ Value GeneratorObject::next_impl(VM& vm, GlobalObject& global_object, Optional<V
if (!next_block) {
// The generator has terminated, now we can simply return done=true.
m_done = true;
result->put("done", Value(true));
result->define_direct_property("done", Value(true), JS::default_attributes);
return result;
}
@ -115,8 +115,8 @@ Value GeneratorObject::next_impl(VM& vm, GlobalObject& global_object, Optional<V
m_done = generated_continuation(m_previous_value) == nullptr;
result->put("value", generated_value(m_previous_value));
result->put("done", Value(m_done));
result->define_direct_property("value", generated_value(m_previous_value), JS::default_attributes);
result->define_direct_property("done", Value(m_done), JS::default_attributes);
if (vm.exception())
return {};