diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-07-26 16:48:47 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-07-26 16:15:31 +0100 |
commit | 2c6bd3a61b3e9a030a85bac8ba46b6bbca3fe7e8 (patch) | |
tree | 8853f3f1c534428484358eac7bcbd1cf6727e952 /Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h | |
parent | c5c32ad2747ada20dd45c84d5322d43dfa71cfdd (diff) | |
download | serenity-2c6bd3a61b3e9a030a85bac8ba46b6bbca3fe7e8.zip |
LibJS: Use narrower types in Temporal PlainDate/PlainDateTime/Calendar
These are bounds-checked during construction of PlainDate/PlainDateTime
and as such theres no need to widen them in these internal AO calls.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h index 3265f7f59d..abc49edfca 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDate.h @@ -15,12 +15,12 @@ class PlainDate final : public Object { JS_OBJECT(PlainDate, Object); public: - PlainDate(i32 iso_year, i32 iso_month, i32 iso_day, Object& calendar, Object& prototype); + PlainDate(i32 iso_year, u8 iso_month, u8 iso_day, Object& calendar, Object& prototype); virtual ~PlainDate() override = default; [[nodiscard]] i32 iso_year() const { return m_iso_year; } - [[nodiscard]] i32 iso_month() const { return m_iso_month; } - [[nodiscard]] i32 iso_day() const { return m_iso_day; } + [[nodiscard]] u8 iso_month() const { return m_iso_month; } + [[nodiscard]] u8 iso_day() const { return m_iso_day; } [[nodiscard]] Object const& calendar() const { return m_calendar; } [[nodiscard]] Object& calendar() { return m_calendar; } @@ -28,15 +28,15 @@ private: virtual void visit_edges(Visitor&) override; // 3.4 Properties of Temporal.PlainDate Instances, https://tc39.es/proposal-temporal/#sec-properties-of-temporal-plaindate-instances - i32 m_iso_year { 0 }; // [[ISOYear]] - i32 m_iso_month { 1 }; // [[ISOMonth]] - i32 m_iso_day { 1 }; // [[ISODay]] - Object& m_calendar; // [[Calendar]] + i32 m_iso_year { 0 }; // [[ISOYear]] + u8 m_iso_month { 1 }; // [[ISOMonth]] + u8 m_iso_day { 1 }; // [[ISODay]] + Object& m_calendar; // [[Calendar]] }; -PlainDate* create_temporal_date(GlobalObject&, i32 iso_year, i32 iso_month, i32 iso_day, Object& calendar, FunctionObject* new_target = nullptr); +PlainDate* create_temporal_date(GlobalObject&, i32 iso_year, u8 iso_month, u8 iso_day, Object& calendar, FunctionObject* new_target = nullptr); PlainDate* to_temporal_date(GlobalObject&, Value item, Object* options = nullptr); Optional<TemporalDate> regulate_iso_date(GlobalObject&, double year, double month, double day, String const& overflow); -bool is_valid_iso_date(i32 year, i32 month, i32 day); +bool is_valid_iso_date(i32 year, u8 month, u8 day); } |