mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:58:11 +00:00
LibJS: Do not expose mathematical values to script in Duration methods
This is an editorial change in the Temporal spec.
See: 26a4c4f
No behavioral change as we already did this correctly, but I changed
some implicit JS::Value creations to explicit ones.
This commit is contained in:
parent
a496868ee5
commit
4722045e28
2 changed files with 10 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
@ -157,16 +157,16 @@ JS_DEFINE_NATIVE_FUNCTION(DurationConstructor::compare)
|
|||
auto* nanoseconds2_bigint = js_bigint(vm, Crypto::SignedBigInteger::create_from((i64)two->nanoseconds()));
|
||||
auto* ns2 = total_duration_nanoseconds(global_object, days2, two->hours(), two->minutes(), two->seconds(), two->milliseconds(), two->microseconds(), *nanoseconds2_bigint, shift2);
|
||||
|
||||
// 11. If ns1 > ns2, return 1.
|
||||
// 11. If ns1 > ns2, return 1𝔽.
|
||||
if (ns1->big_integer() > ns2->big_integer())
|
||||
return 1;
|
||||
return Value(1);
|
||||
|
||||
// 12. If ns1 < ns2, return −1.
|
||||
// 12. If ns1 < ns2, return −1𝔽.
|
||||
if (ns1->big_integer() < ns2->big_integer())
|
||||
return -1;
|
||||
return Value(-1);
|
||||
|
||||
// 13. Return 0.
|
||||
return 0;
|
||||
// 13. Return +0𝔽.
|
||||
return Value(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue