summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-06-14 21:20:35 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-15 17:49:20 +0100
commit6982e5311323b7b02c57be5e9eb2d770bc094678 (patch)
tree26e215aca4dc2f355e219d4269fb7b105c4cb454 /Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
parent9bcd88828f0bcd6a53017af9ad7db1d3a27c4ca0 (diff)
downloadserenity-6982e5311323b7b02c57be5e9eb2d770bc094678.zip
LibJS: Leverage ToPartialDuration in ToTemporalDurationRecord
This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/c3efde0
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Temporal/Duration.h')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Temporal/Duration.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
index 044cfd68ef..0187b97c57 100644
--- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
+++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.h
@@ -109,28 +109,28 @@ struct RoundedDuration {
double remainder;
};
-// Table 7: Properties of a TemporalDurationLike, https://tc39.es/proposal-temporal/#table-temporal-temporaldurationlike-properties
+// Table 8: Duration Record Fields, https://tc39.es/proposal-temporal/#table-temporal-duration-record-fields
template<typename StructT, typename ValueT>
-struct TemporalDurationLikeProperty {
- ValueT StructT::*field { nullptr };
- PropertyKey property;
+struct TemporalDurationRecordField {
+ ValueT StructT::*field_name { nullptr };
+ PropertyKey property_name;
};
template<typename StructT, typename ValueT>
-auto temporal_duration_like_properties = [](VM& vm) {
- using PropertyT = TemporalDurationLikeProperty<StructT, ValueT>;
- return AK::Array<PropertyT, 10> {
- PropertyT { &StructT::days, vm.names.days },
- PropertyT { &StructT::hours, vm.names.hours },
- PropertyT { &StructT::microseconds, vm.names.microseconds },
- PropertyT { &StructT::milliseconds, vm.names.milliseconds },
- PropertyT { &StructT::minutes, vm.names.minutes },
- PropertyT { &StructT::months, vm.names.months },
- PropertyT { &StructT::nanoseconds, vm.names.nanoseconds },
- PropertyT { &StructT::seconds, vm.names.seconds },
- PropertyT { &StructT::weeks, vm.names.weeks },
- PropertyT { &StructT::years, vm.names.years },
+auto temporal_duration_record_fields = [](VM& vm) {
+ using FieldT = TemporalDurationRecordField<StructT, ValueT>;
+ return AK::Array {
+ FieldT { &StructT::days, vm.names.days },
+ FieldT { &StructT::hours, vm.names.hours },
+ FieldT { &StructT::microseconds, vm.names.microseconds },
+ FieldT { &StructT::milliseconds, vm.names.milliseconds },
+ FieldT { &StructT::minutes, vm.names.minutes },
+ FieldT { &StructT::months, vm.names.months },
+ FieldT { &StructT::nanoseconds, vm.names.nanoseconds },
+ FieldT { &StructT::seconds, vm.names.seconds },
+ FieldT { &StructT::weeks, vm.names.weeks },
+ FieldT { &StructT::years, vm.names.years },
};
};