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

LibJS: Remove Object::value_of()

Being really close to Object.prototype.valueOf() name wise makes this
unnecessarily confusing - while it sometimes serves as the
implementation of a valueOf() function, it's an abstraction which the
spec doesn't have.
Use the appropriate getters to retrieve specific internal slots instead,
most commonly [[FooData]] from the primitive wrapper objects.
For the Object class specifically, use the Value(Object*) ctor instead.
This commit is contained in:
Linus Groh 2021-12-10 22:50:02 +00:00
parent 07c5419a82
commit 038d354b5d
14 changed files with 20 additions and 38 deletions

View file

@ -145,9 +145,9 @@ ThrowCompletionOr<String> JSONObject::serialize_json_property(GlobalObject& glob
else if (is<StringObject>(value_object))
value = TRY(value.to_primitive_string(global_object));
else if (is<BooleanObject>(value_object))
value = static_cast<BooleanObject&>(value_object).value_of();
value = Value(static_cast<BooleanObject&>(value_object).boolean());
else if (is<BigIntObject>(value_object))
value = static_cast<BigIntObject&>(value_object).value_of();
value = Value(&static_cast<BigIntObject&>(value_object).bigint());
}
if (value.is_null())