1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

LibJS: Convert Object::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent f990095728
commit ddc6e139a6
45 changed files with 80 additions and 80 deletions

View file

@ -102,7 +102,7 @@ ThrowCompletionOr<DeprecatedString> JSONObject::stringify_impl(VM& vm, Value val
state.gap = DeprecatedString::empty();
}
auto* wrapper = Object::create(realm, realm.intrinsics().object_prototype());
auto wrapper = Object::create(realm, realm.intrinsics().object_prototype());
MUST(wrapper->create_data_property_or_throw(DeprecatedString::empty(), value));
return serialize_json_property(vm, state, DeprecatedString::empty(), wrapper);
}
@ -401,7 +401,7 @@ JS_DEFINE_NATIVE_FUNCTION(JSONObject::parse)
return vm.throw_completion<SyntaxError>(ErrorType::JsonMalformed);
Value unfiltered = parse_json_value(vm, json.value());
if (reviver.is_function()) {
auto* root = Object::create(realm, realm.intrinsics().object_prototype());
auto root = Object::create(realm, realm.intrinsics().object_prototype());
auto root_name = DeprecatedString::empty();
MUST(root->create_data_property_or_throw(root_name, unfiltered));
return internalize_json_property(vm, root, root_name, reviver.as_function());
@ -431,7 +431,7 @@ Value JSONObject::parse_json_value(VM& vm, JsonValue const& value)
Object* JSONObject::parse_json_object(VM& vm, JsonObject const& json_object)
{
auto& realm = *vm.current_realm();
auto* object = Object::create(realm, realm.intrinsics().object_prototype());
auto object = Object::create(realm, realm.intrinsics().object_prototype());
json_object.for_each_member([&](auto& key, auto& value) {
object->define_direct_property(key, parse_json_value(vm, value), default_attributes);
});