Linus Groh
f7fe7f8c77
LibJS: Capture TimeFraction parse result instead of Fraction
...
Not much of a difference as TimeFraction just parses Fraction, but let's
do it correctly. Small mistake I did in 4b7f716
.
Thanks to YouTube user gla3dr for noticing this :^)
2021-12-19 09:29:46 +00:00
Linus Groh
4b7f716f21
LibJS: Fix ambiguity in FractionalPart grammar
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/0f11bd6
2021-12-18 22:32:39 +00:00
Linus Groh
006bea5d31
LibJS: Remove outdated comment in prepare_partial_temporal_fields()
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/bf066ea
2021-12-18 22:32:39 +00:00
Linus Groh
7270bbb255
LibJS: Remove outdated comment from parse_temporal_duration_string()
...
This is a normative change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/e7182d3
- https://github.com/tc39/proposal-temporal/commit/6dae066
2021-12-18 22:32:39 +00:00
Luke Wilde
4f3c283f24
LibJS: Move calendar validation out of parse_temporal_calendar_string
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/7207a1c
2021-12-08 19:11:50 +00:00
Luke Wilde
80dcddacea
LibJS: Simplify return in parse_temporal_date_time_string
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/1f7e486
2021-12-08 19:11:50 +00:00
Luke Wilde
6244969ae2
LibJS: Remove duplicated spec step in parse_iso_date_time
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/516bf24
2021-12-08 19:11:50 +00:00
Timothy Flynn
1039159a6c
LibJS: Change LargerOfTwoTemporalUnits AO to return a StringView
2021-11-30 00:01:07 +00:00
Linus Groh
f7ba81ac52
LibJS: Implement parsing of TemporalDurationString
2021-11-28 10:32:28 +00:00
Linus Groh
1e41a8668d
LibJS: Add sign(Crypto::SignedBigInteger const&) overload
2021-11-24 17:53:00 +00:00
Linus Groh
78724fdd33
LibJS: Don't accept UTC designators in strings for plain Temporal types
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/cd2dc7d
2021-11-24 08:56:03 +00:00
Linus Groh
836ce8ee5d
LibJS: Fix parse ErrorType used in parse_temporal_date_string()
...
TemporalInvalidDateString, not TemporalInvalidDateTimeString.
2021-11-24 08:38:50 +00:00
Linus Groh
55dbd19a16
LibJS: Update to_largest_temporal_unit() to allow undefined fallback
...
This is required for Temporal.Duration.prototype.round(). Subsequently,
this now returns ThrowCompletionOr<Optional<String>>, which brings the
signature in line with that of to_smallest_temporal_unit().
Much nicer! :^)
2021-11-23 21:03:05 +00:00
Linus Groh
783222f87a
LibJS: Implement parsing of TemporalInstantString
2021-11-20 23:10:09 +00:00
Linus Groh
79a18b058f
LibJS: Implement parsing of TemporalCalendarString
2021-11-20 23:10:09 +00:00
Linus Groh
1583c7257c
LibJS: Implement parsing of TemporalRelativeToString
2021-11-20 23:10:09 +00:00
Linus Groh
98b876ad3f
LibJS: Implement parsing of TemporalZonedDateTimeString
2021-11-20 23:10:09 +00:00
Linus Groh
3b1de431cc
LibJS: Implement parsing of TemporalYearMonthString
2021-11-20 23:10:09 +00:00
Linus Groh
3ddab2f4fe
LibJS: Implement parsing of TemporalMonthDayString
2021-11-20 23:10:09 +00:00
Linus Groh
453c78215c
LibJS: Implement parsing of TemporalTimeString
2021-11-20 23:10:09 +00:00
Linus Groh
b42b7d5f16
LibJS: Implement parsing of TemporalDateTimeString
2021-11-20 23:10:09 +00:00
Linus Groh
02e7de2cba
LibJS: Implement parsing of TemporalDateString
2021-11-20 23:10:09 +00:00
Linus Groh
9628452550
LibJS: Fix fallback of hour, minute, second in parse_iso_date_time()
...
It's not the `to_uint<u8>()` call that would fail, if we have a value
for these productions they will always be valid numbers. We do need to
provide a fallback for when that's not the case and any of them is
undefined, i.e. an empty Optional.
2021-11-20 23:10:09 +00:00
Linus Groh
de23f0b68c
LibJS: Start fleshing out an ISO 8601 parser for Temporal
...
This is the start of a parser for the ISO 8601 grammar used in the
Temporal spec:
https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar
We will, on purpose, not use a generic ISO 8601 parser from AK or
similar for two reasons:
- Many AOs make specific assumptions about which productions exist and
access them directly, even when they're part of a larger production.
- The spec says "The grammar deviates from the standard given in ISO
8601 in the following ways:" and then lists 17 of such deviations.
Making that work with a general purpose parser is not worth it.
The public API is not being used anywhere yet, but will be in the next
couple of commits. Likewise, the Production enum will be populated with
all the productions accessed directly (e.g. TemporalDateString).
Many thanks to Ali for showing me how to improve my initial approach
full of macros with a nice RAII helper - it's much nicer :^)
Co-Authored-By: Ali Mohammad Pur <mpfard@serenityos.org>
2021-11-20 23:10:09 +00:00
Linus Groh
8d6d39e07c
LibJS: Treat relativeTo parameters as PlainDate or ZonedDateTime
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/c822e14
2021-11-19 19:59:13 +00:00
Linus Groh
ec1e1f4f12
LibJS: Disallow Temporal.Duration input values to be non-integers
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/8c85450
2021-11-17 22:20:59 +00:00
Luke Wilde
ac65fb40d9
LibJS: Implement Temporal.PlainDate.prototype.since
2021-11-16 01:06:07 +00:00
Linus Groh
dbe70e7c55
LibJS: Implement Temporal.Duration.prototype.total()
2021-11-13 18:50:54 +00:00
Linus Groh
0d9defdad8
LibJS: Rename MatchBehavior members back to their old names
...
I changed this in 6ef1a27
to "match the spec", but the spec calls it
`match exactly` and `match minutes` - so what we had before was correct
and the change made no sense whatsoever.
2021-11-13 00:25:40 +00:00
Luke Wilde
29072f4b09
LibJS: Implement the required AOs for Temporal.Duration.compare
2021-11-11 21:06:54 +00:00
Linus Groh
fdffdc43fa
LibJS: Implement the rest of to_temporal_month_day()
...
Always throws at the moment, because parse_temporal_month_day_string()
is basically a stub, and parse_iso_date_time() isn't functional either.
The spec issue has been resolved though, so I figured we might as well
get one small step further :^)
2021-11-10 22:28:27 +00:00
Luke Wilde
dc72d416b2
LibJS: Implement the required AOs for ZonedDateTime stringifiers
2021-11-10 12:56:56 +00:00
Linus Groh
c3c9ac93d0
LibJS: Implement Temporal.PlainDate.prototype.with()
...
With one caveat: in the PreparePartialTemporalFields AO I made a change
to fix a spec issue that would require the input object to always have a
month or monthCode property.
This is tracked in https://github.com/tc39/proposal-temporal/issues/1910
and may get accepted as-is, in which case we simply need to remove the
NOTE comment.
2021-11-08 22:19:45 +00:00
Linus Groh
46d7c34028
LibJS: Use StringView literals in prepare_temporal_fields()
2021-11-08 19:12:47 +00:00
Linus Groh
b2548393d2
LibJS: Implement Temporal.Duration.prototype.toString()
...
I hereby claim "implemented largest AO in LibJS ever" (450 lines). :^)
2021-11-07 15:31:28 +01:00
Luke Wilde
2b89d2a360
LibJS: Implement ToTemporalZonedDateTime and the required AOs
2021-11-07 15:35:16 +02:00
Linus Groh
0dae7c9420
LibJS: Replace a couple of TODO()'s in Temporal with InternalError
...
This helps us to distinguish between crashes because of incomplete code
paths and crashes because of genuine bugs more easily when running
test262.
2021-11-04 23:59:40 +01:00
Linus Groh
d129e1ff29
LibJS: Move common code into RejectObjectWithCalendarOrTimeZone
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/5654fe0
2021-11-04 16:17:26 +01:00
Luke Wilde
d1a5254e41
LibJS: Implement Temporal.PlainDateTime.prototype.round
2021-11-03 19:48:08 +01:00
Linus Groh
d49bbb1da3
LibJS: Implement TODO()'d parts of balance_duration()
...
Massive :yakstack:, so I understand why it was skipped in the first
place :^)
2021-11-02 09:24:35 +01:00
Linus Groh
97f6c6029f
LibJS: Implement Temporal.TimeZone.prototype.getInstantFor()
2021-11-01 21:39:45 +01:00
Linus Groh
2cbcb99ec7
LibJS: Update spec comment in parse_temporal_time_zone_string()
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/19b693c
2021-10-30 23:15:18 +02:00
Linus Groh
5da8ae0020
LibJS: Update parse_temporal_time_zone_string() substring bounds
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/73b9fe3
2021-10-30 23:14:43 +02:00
Linus Groh
09d1db5afd
LibJS: Clarify mathematical types in Temporal AOs and functions
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/e480d40
2021-10-26 23:10:11 +02:00
Andreas Kling
398c181c79
LibJS: Rename PropertyName to PropertyKey
...
Let's use the same name as the spec. :^)
2021-10-24 17:18:07 +02:00
Linus Groh
0881f8160f
LibJS: Use implicit ThrowCompletionOr<T> constructor where possible
...
Luckily this is not very widespread yet as most of it would happen in
the various JS functions instead of AOs.
2021-10-21 09:02:23 +01:00
Timothy Flynn
ec54a7b5b0
LibJS: Implement IteratorClose with Completions and align to the spec
2021-10-21 00:26:45 +01:00
Timothy Flynn
7b4814f74c
LibJS: Convert IteratorValue AO to ThrowCompletionOr
2021-10-21 00:26:45 +01:00
Timothy Flynn
8be1caa05d
LibJS: Convert IteratorStep AO to ThrowCompletionOr
2021-10-21 00:26:45 +01:00
Timothy Flynn
860a37640b
LibJS: Convert GetIterator AO to ThrowCompletionOr
2021-10-21 00:26:45 +01:00