LibJS: Mark getters of more Temporal objects [[nodiscard]]

PlainDate, PlainTime, and PlainDateTime already do this. All the others
should as well.
This commit is contained in:
Linus Groh 2021-08-07 21:50:35 +01:00
parent aabbfa78e2
commit 53c44bea00
5 changed files with 20 additions and 20 deletions

View file

@ -20,7 +20,7 @@ public:
Calendar(String identifier, Object& prototype);
virtual ~Calendar() override = default;
String const& identifier() const { return m_identifier; }
[[nodiscard]] String const& identifier() const { return m_identifier; }
private:
// 12.5 Properties of Temporal.Calendar Instances, https://tc39.es/proposal-temporal/#sec-properties-of-temporal-calendar-instances

View file

@ -18,16 +18,16 @@ public:
Duration(double years, double months, double weeks, double days, double hours, double minutes, double seconds, double milliseconds, double microseconds, double nanoseconds, Object& prototype);
virtual ~Duration() override = default;
double years() const { return m_years; }
double months() const { return m_months; }
double weeks() const { return m_weeks; }
double days() const { return m_days; }
double hours() const { return m_hours; }
double minutes() const { return m_minutes; }
double seconds() const { return m_seconds; }
double milliseconds() const { return m_milliseconds; }
double microseconds() const { return m_microseconds; }
double nanoseconds() const { return m_nanoseconds; }
[[nodiscard]] double years() const { return m_years; }
[[nodiscard]] double months() const { return m_months; }
[[nodiscard]] double weeks() const { return m_weeks; }
[[nodiscard]] double days() const { return m_days; }
[[nodiscard]] double hours() const { return m_hours; }
[[nodiscard]] double minutes() const { return m_minutes; }
[[nodiscard]] double seconds() const { return m_seconds; }
[[nodiscard]] double milliseconds() const { return m_milliseconds; }
[[nodiscard]] double microseconds() const { return m_microseconds; }
[[nodiscard]] double nanoseconds() const { return m_nanoseconds; }
private:
// 7.4 Properties of Temporal.Duration Instances, https://tc39.es/proposal-temporal/#sec-properties-of-temporal-duration-instances

View file

@ -20,7 +20,7 @@ public:
Instant(BigInt& nanoseconds, Object& prototype);
virtual ~Instant() override = default;
BigInt const& nanoseconds() const { return m_nanoseconds; }
[[nodiscard]] BigInt const& nanoseconds() const { return m_nanoseconds; }
private:
virtual void visit_edges(Visitor&) override;

View file

@ -22,8 +22,8 @@ public:
TimeZone(String identifier, Object& prototype);
virtual ~TimeZone() override = default;
String const& identifier() const { return m_identifier; }
Optional<OffsetType> const& offset_nanoseconds() const { return m_offset_nanoseconds; }
[[nodiscard]] String const& identifier() const { return m_identifier; }
[[nodiscard]] Optional<OffsetType> const& offset_nanoseconds() const { return m_offset_nanoseconds; }
void set_offset_nanoseconds(OffsetType offset_nanoseconds) { m_offset_nanoseconds = offset_nanoseconds; };
private:

View file

@ -18,12 +18,12 @@ public:
ZonedDateTime(BigInt& nanoseconds, Object& time_zone, Object& calendar, Object& prototype);
virtual ~ZonedDateTime() override = default;
BigInt const& nanoseconds() const { return m_nanoseconds; }
BigInt& nanoseconds() { return m_nanoseconds; }
Object const& time_zone() const { return m_time_zone; }
Object& time_zone() { return m_time_zone; }
Object const& calendar() const { return m_calendar; }
Object& calendar() { return m_calendar; }
[[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; }
[[nodiscard]] Object& calendar() { return m_calendar; }
private:
virtual void visit_edges(Visitor&) override;