summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-08-07 21:50:35 +0100
committerLinus Groh <mail@linusgroh.de>2021-08-08 17:45:06 +0100
commit53c44bea00db369e7edc6cb3b19a91414a5fb9bf (patch)
treeee102509c3b6bc2cffb4bfa17d1ae64abe1e0c45 /Userland/Libraries
parentaabbfa78e2314f6fe8cb02362ac3e2d3702f25e7 (diff)
downloadserenity-53c44bea00db369e7edc6cb3b19a91414a5fb9bf.zip
LibJS: Mark getters of more Temporal objects [[nodiscard]]
PlainDate, PlainTime, and PlainDateTime already do this. All the others should as well.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Duration.h20
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Instant.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.h12
5 files changed, 20 insertions, 20 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h
index fe2c9bd13c..653d37b175 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.h
@@ -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
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
index e5e9e094fc..559d2498e5 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
@@ -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
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h
index 2ea0efafc2..77caf6acb1 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Instant.h
@@ -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;
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h
index b173193bac..3b086c84b3 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h
@@ -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:
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.h b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.h
index 67cf49f779..d364454027 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.h
@@ -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;