1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]

This is where the fun begins. :^)
This commit is contained in:
Linus Groh 2022-08-21 14:00:56 +01:00
parent f6c4a0f5d0
commit a022e548b8
129 changed files with 1230 additions and 1325 deletions

View file

@ -191,11 +191,8 @@ ThrowCompletionOr<Value> get_option(VM& vm, Object const& options, PropertyKey c
template<typename... Args>
ThrowCompletionOr<double> to_integer_throw_on_infinity(VM& vm, Value argument, ErrorType error_type, Args... args)
{
auto& realm = *vm.current_realm();
auto& global_object = realm.global_object();
// 1. Let integer be ? ToIntegerOrInfinity(argument).
auto integer = TRY(argument.to_integer_or_infinity(global_object));
auto integer = TRY(argument.to_integer_or_infinity(vm));
// 2. If integer is -∞ or +∞ , then
if (Value(integer).is_infinity()) {
@ -211,11 +208,8 @@ ThrowCompletionOr<double> to_integer_throw_on_infinity(VM& vm, Value argument, E
template<typename... Args>
ThrowCompletionOr<double> to_integer_without_rounding(VM& vm, Value argument, ErrorType error_type, Args... args)
{
auto& realm = *vm.current_realm();
auto& global_object = realm.global_object();
// 1. Let number be ? ToNumber(argument).
auto number = TRY(argument.to_number(global_object));
auto number = TRY(argument.to_number(vm));
// 2. If number is NaN, +0𝔽, or -0𝔽, return 0.
if (number.is_nan() || number.is_positive_zero() || number.is_negative_zero())