1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:17:35 +00:00

LibJS: Store Instant's and ZonedDateTime's m_nanoseconds as a const&

There's no need for these to be non-const. Suggested by @IdanHo in
https://github.com/SerenityOS/serenity/pull/9904#discussion_r704960184.

Perhaps we can make more internal slots of these and other objects const
references as well, but that's a bit more involved as they are used by
various functions expecting non-const references.
This commit is contained in:
Linus Groh 2021-09-09 21:18:08 +01:00
parent e4c07c5b8f
commit 5ae6ad8557
4 changed files with 12 additions and 14 deletions

View file

@ -20,7 +20,7 @@
namespace JS::Temporal {
// 8 Temporal.Instant Objects, https://tc39.es/proposal-temporal/#sec-temporal-instant-objects
Instant::Instant(BigInt& nanoseconds, Object& prototype)
Instant::Instant(BigInt const& nanoseconds, Object& prototype)
: Object(prototype)
, m_nanoseconds(nanoseconds)
{
@ -49,7 +49,7 @@ bool is_valid_epoch_nanoseconds(BigInt const& epoch_nanoseconds)
}
// 8.5.2 CreateTemporalInstant ( epochNanoseconds [ , newTarget ] ), https://tc39.es/proposal-temporal/#sec-temporal-createtemporalinstant
Instant* create_temporal_instant(GlobalObject& global_object, BigInt& epoch_nanoseconds, FunctionObject const* new_target)
Instant* create_temporal_instant(GlobalObject& global_object, BigInt const& epoch_nanoseconds, FunctionObject const* new_target)
{
auto& vm = global_object.vm();