mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibJS: Add Handle::operator->()
This commit is contained in:
parent
a1580a1d00
commit
fed6a76990
Notes:
sideshowbarker
2024-07-17 23:03:19 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/fed6a769906
2 changed files with 5 additions and 2 deletions
|
@ -53,6 +53,9 @@ public:
|
|||
|
||||
bool is_null() const { return m_impl.is_null(); }
|
||||
|
||||
T* operator->() { return cell(); }
|
||||
T const* operator->() const { return cell(); }
|
||||
|
||||
private:
|
||||
explicit Handle(NonnullRefPtr<HandleImpl> impl)
|
||||
: m_impl(move(impl))
|
||||
|
|
|
@ -388,7 +388,7 @@ ThrowCompletionOr<BalancedDuration> balance_duration(GlobalObject& global_object
|
|||
days = result.days;
|
||||
|
||||
// c. Set nanoseconds to result.[[Nanoseconds]].
|
||||
total_nanoseconds = result.nanoseconds.cell()->big_integer();
|
||||
total_nanoseconds = result.nanoseconds->big_integer();
|
||||
}
|
||||
// 5. Else,
|
||||
else {
|
||||
|
@ -1238,7 +1238,7 @@ ThrowCompletionOr<RoundedDuration> round_duration(GlobalObject& global_object, d
|
|||
auto result = TRY(nanoseconds_to_days(global_object, *nanoseconds_bigint, intermediate));
|
||||
|
||||
// e. Set days to days + result.[[Days]] + result.[[Nanoseconds]] / result.[[DayLength]].
|
||||
auto nanoseconds_division_result = result.nanoseconds.cell()->big_integer().divided_by(Crypto::UnsignedBigInteger::create_from((u64)result.day_length));
|
||||
auto nanoseconds_division_result = result.nanoseconds->big_integer().divided_by(Crypto::UnsignedBigInteger::create_from((u64)result.day_length));
|
||||
days += result.days + nanoseconds_division_result.quotient.to_double() + nanoseconds_division_result.remainder.to_double() / result.day_length;
|
||||
|
||||
// f. Set hours, minutes, seconds, milliseconds, microseconds, and nanoseconds to 0.
|
||||
|
|
Loading…
Reference in a new issue