mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-02 16:33:13 +00:00
LibJS: Prefer "define_property" over "put"
This commit is contained in:
parent
c485c86015
commit
531fdb2e82
Notes:
sideshowbarker
2024-07-19 04:56:33 +09:00
Author: https://github.com/mattco98
Commit: 531fdb2e82
Pull-request: https://github.com/SerenityOS/serenity/pull/2751
Reviewed-by: https://github.com/linusg ✅
3 changed files with 5 additions and 5 deletions
|
@ -433,7 +433,7 @@ Object* JSONObject::parse_json_object(Interpreter& interpreter, GlobalObject& gl
|
|||
{
|
||||
auto* object = Object::create_empty(interpreter, global_object);
|
||||
json_object.for_each_member([&](auto& key, auto& value) {
|
||||
object->put(key, parse_json_value(interpreter, global_object, value));
|
||||
object->define_property(key, parse_json_value(interpreter, global_object, value));
|
||||
});
|
||||
return object;
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ Array* JSONObject::parse_json_array(Interpreter& interpreter, GlobalObject& glob
|
|||
auto* array = Array::create(global_object);
|
||||
size_t index = 0;
|
||||
json_array.for_each([&](auto& value) {
|
||||
array->put(index++, parse_json_value(interpreter, global_object, value));
|
||||
array->define_property(index++, parse_json_value(interpreter, global_object, value));
|
||||
});
|
||||
return array;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue