mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:17:44 +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:
parent
e4c07c5b8f
commit
5ae6ad8557
4 changed files with 12 additions and 14 deletions
|
@ -15,11 +15,10 @@ class ZonedDateTime final : public Object {
|
|||
JS_OBJECT(ZonedDateTime, Object);
|
||||
|
||||
public:
|
||||
ZonedDateTime(BigInt& nanoseconds, Object& time_zone, Object& calendar, Object& prototype);
|
||||
ZonedDateTime(BigInt const& nanoseconds, Object& time_zone, Object& calendar, Object& prototype);
|
||||
virtual ~ZonedDateTime() override = default;
|
||||
|
||||
[[nodiscard]] BigInt const& nanoseconds() const { return m_nanoseconds; }
|
||||
[[nodiscard]] BigInt& nanoseconds() { return m_nanoseconds; }
|
||||
[[nodiscard]] Object const& time_zone() const { return m_time_zone; }
|
||||
[[nodiscard]] Object& time_zone() { return m_time_zone; }
|
||||
[[nodiscard]] Object const& calendar() const { return m_calendar; }
|
||||
|
@ -29,11 +28,11 @@ private:
|
|||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
// 6.4 Properties of Temporal.ZonedDateTime Instances, https://tc39.es/proposal-temporal/#sec-properties-of-temporal-zoneddatetime-instances
|
||||
BigInt& m_nanoseconds; // [[Nanoseconds]]
|
||||
Object& m_time_zone; // [[TimeZone]]
|
||||
Object& m_calendar; // [[Calendar]]
|
||||
BigInt const& m_nanoseconds; // [[Nanoseconds]]
|
||||
Object& m_time_zone; // [[TimeZone]]
|
||||
Object& m_calendar; // [[Calendar]]
|
||||
};
|
||||
|
||||
ZonedDateTime* create_temporal_zoned_date_time(GlobalObject&, BigInt& epoch_nanoseconds, Object& time_zone, Object& calendar, FunctionObject const* new_target = nullptr);
|
||||
ZonedDateTime* create_temporal_zoned_date_time(GlobalObject&, BigInt const& epoch_nanoseconds, Object& time_zone, Object& calendar, FunctionObject const* new_target = nullptr);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue