mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibJS: Migrate ToIntegerIfIntegral to ECMA-262
This is an editorial change in the Temporal proposal. See:
5f76109
This commit is contained in:
parent
a8d6e5c3db
commit
aa737bb654
Notes:
github-actions[bot]
2025-03-01 13:50:37 +00:00
Author: https://github.com/trflynn89
Commit: aa737bb654
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3734
3 changed files with 16 additions and 16 deletions
|
@ -243,19 +243,4 @@ ThrowCompletionOr<double> to_positive_integer_with_truncation(VM& vm, Value argu
|
|||
return integer;
|
||||
}
|
||||
|
||||
// 13.39 ToIntegerIfIntegral ( argument ), https://tc39.es/proposal-temporal/#sec-tointegerifintegral
|
||||
template<typename... Args>
|
||||
ThrowCompletionOr<double> to_integer_if_integral(VM& vm, Value argument, ErrorType error_type, Args&&... args)
|
||||
{
|
||||
// 1. Let number be ? ToNumber(argument).
|
||||
auto number = TRY(argument.to_number(vm));
|
||||
|
||||
// 2. If number is not an integral Number, throw a RangeError exception.
|
||||
if (!number.is_integral_number())
|
||||
return vm.throw_completion<RangeError>(error_type, forward<Args>(args)...);
|
||||
|
||||
// 3. Return ℝ(number).
|
||||
return number.as_double();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue