Linus Groh
cc8f5151d7
LibJS: Refactor Temporal since/until to common AOs
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/85a9f57
2022-05-08 00:07:58 +02:00
Linus Groh
c6f7214a60
LibJS: Replace magic nanosecond numbers with constants
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/3fdbfda
2022-05-08 00:07:58 +02:00
Linus Groh
3729a910f6
LibJS: Refactor Temporal add/subtract to common AOs
...
This is an editorial change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/2f96efc
- https://github.com/tc39/proposal-temporal/commit/fbff635
2022-05-08 00:07:58 +02:00
Linus Groh
27793bf76c
LibJS: Replace U+2212 MINUS SIGN with U+002D HYPHEN-MINUS
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/bbcd37b
2022-04-29 22:40:46 +02:00
Linus Groh
70593b7448
LibJS: Update for structured headers added to various Temporal AOs
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/e6a15a5
2022-04-29 22:40:46 +02:00
Linus Groh
5397278bfc
LibJS: Update spec comments to use ToZeroPaddedDecimalString AO
...
This is an editorial change in the ECMA-262 and Temporal specs.
See:
- https://github.com/tc39/ecma262/commit/843d8b8
- https://github.com/tc39/proposal-temporal/commit/f9211d9
Note that we don't actually need to implement the AO as we already have
String::formatted() for this, and use unified format strings instead of
zero-padding in individual steps in many cases anyway.
2022-04-12 23:43:29 +01:00
Linus Groh
2ad69d789b
LibJS: Remove the ConstrainToRange AO
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/537b3e6
2022-03-16 21:49:38 +00:00
Linus Groh
17da627b4c
LibJS: Fix "set it to" language to be more explicit
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/de58241
2022-03-10 23:20:39 +01:00
Linus Groh
a496868ee5
LibJS: Create Duration Records with their own abstract operations
...
This is an editorial change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/387c405
- https://github.com/tc39/proposal-temporal/commit/b203e26
- https://github.com/tc39/proposal-temporal/commit/387c405
2022-03-10 23:20:39 +01:00
Linus Groh
64e43c89bc
LibJS: Remove assertions that are now part of structured headers
...
This is an editorial change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/7fbdd28
- https://github.com/tc39/proposal-temporal/commit/f666243
- https://github.com/tc39/proposal-temporal/commit/8c7d066
- https://github.com/tc39/proposal-temporal/commit/307d108
- https://github.com/tc39/proposal-temporal/commit/d9ca402
In practical terms this means we can now get rid of a couple of awkward
assertion steps that were no-ops anyway, since the types are enforced
by the compiler.
2022-03-10 23:20:39 +01:00
Linus Groh
bdb13a74b0
LibJS: Describe various kinds of "Duration Records"
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/983902e
We already had these defined as structs, but now they're properly
defined in the spec (opposed to the previous anonymous records), and we
don't have to make up our own names anymore :^)
Note that while we're usually not including 'record' in the name, in
this case the 'Duration Record' has a name clash with the Duration
object. Additionally, later editorial changes introduce CreateFooRecord
AOs, so let's just go with FooRecord structs here.
2022-03-10 23:20:39 +01:00
Linus Groh
9c209b8079
LibJS: Support modulo(x, y) with different types
...
It's a bit annoying having to add '.0' to y given that it's an integral
number in most cases.
This turns the single template parameter T into T and U to permit that.
2021-12-22 11:27:31 +01:00
Linus Groh
42071f69cf
LibJS: Fix balance_time() for times with negative offset day outcome
...
...and change the parameter types from i64 to double, as predicted by
a FIXME. The issue here is that integer division with a negative
dividend doesn't yield the same result as floating point division
wrapped in floor().
Additionally, the `days` variable needs to be signed.
2021-11-14 23:10:00 +00:00
Linus Groh
a3b8303f3c
LibJS: Fix modulo() template argument deduction on i686
...
Userland/Libraries/LibJS/Runtime/Temporal/PlainTime.cpp:283:24:
note: deduced conflicting types for parameter 'T' ('long long int'
and 'long int')
283 | nanosecond = modulo(nanosecond, 1000l);
| ~~~~~~^~~~~~~~~~~~~~~~~~~
Worked fine on x86_84 :yakshrug:
2021-11-07 21:33:56 +00:00
Linus Groh
b3ea7332b2
LibJS: Fix use of "modulo" for negative values in balance_time()
2021-11-07 21:11:31 +00:00
Linus Groh
bb60629d3b
LibJS: Update ToTemporalTimeRecord to not require all properties
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/84b7d53
2021-11-04 16:17:26 +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
4d8912a92b
LibJS: Convert to_string() to ThrowCompletionOr
...
Also update get_function_name() to use ThrowCompletionOr, but this is
not a standard AO and should be refactored out of existence eventually.
2021-10-13 09:55:10 +01:00
Linus Groh
ef004c6b98
LibJS: Use round_number_to_increment(double) in round_time()
...
Much nicer :^)
2021-10-07 13:00:24 +01:00
Linus Groh
b7e5f08e56
LibJS: Convert Object::get() to ThrowCompletionOr
...
To no one's surprise, this patch is pretty big - this is possibly the
most used AO of all of them. Definitely worth it though.
2021-10-03 20:14:03 +01:00
Idan Horowitz
5ce468338e
LibJS: Drop the Temporal prefix from TemporalMissingRequiredProperty
...
This allows us to use it for other exposed JS APIs that accept options
objects.
2021-09-29 10:09:33 +03:00
Linus Groh
20337a34a2
LibJS: Convert Instant AOs to ThrowCompletionOr
2021-09-17 08:25:12 +01:00
Linus Groh
f8d92232c8
LibJS: Convert Calendar AOs to ThrowCompletionOr
2021-09-17 08:25:12 +01:00
Linus Groh
0ccd11ba5f
LibJS: Convert parse_temporal_time_string() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
683e31e1ff
LibJS: Convert to_integer_throw_on_infinity() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Idan Horowitz
229a5ce149
LibJS: Convert PlainTime AOs to ThrowCompletionOr
2021-09-16 13:53:37 +01:00
Idan Horowitz
cc00a726a8
LibJS: Convert TimeZone AOs to ThrowCompletionOr
2021-09-16 13:53:37 +01:00
Idan Horowitz
5a4c90fcb1
LibJS: Convert ordinary_create_from_constructor<T> to ThrowCompletionOr
2021-09-16 13:53:37 +01:00
Linus Groh
c9951ad26b
LibJS: Make to_temporal_time_record() time like Object a const&
...
This only calls Object::get() on the temporal_time_like Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
e4c07c5b8f
LibJS: Make new_target parameter of all Temporal AOs a const*
...
These are passed to ordinary_create_from_constructor() in each case,
which takes the parameter as a const&, so these can also be const.
2021-09-09 23:46:45 +01:00
Linus Groh
9f78a957d5
LibJS: Implement Temporal.PlainTime.prototype.toString()
2021-09-08 23:42:26 +01:00
Luke Wilde
d943b8f100
LibJS: Implement Temporal.PlainTime.prototype.with
...
Ticks off one box in #8982 and fixes one test262 case.
2021-09-08 19:57:29 +01:00
Linus Groh
ed98c1afc7
LibJS: Throw RangeError in PrepareTemporalFields for +/-∞
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/499282a
2021-09-01 15:11:35 +01:00
Idan Horowitz
f6370fe3f7
LibJS: Add the ToTemporalTime AO and stub the ParseTemporalTimeString AO
...
This AO is required for a bunch of PlainTime related methods.
As part of this change the `TemporalTime` record was renamed to
`UnregulatedTemporalTime` and a new `TemporalTime` record that matches
the other Temporal parse result records was added. This also has the
added benefit of getting rid of a would be round-trip cast from integer
to double and back in `ParseTemporalTimeString`.
2021-08-27 19:01:30 +01:00
Idan Horowitz
28fa4d1568
LibJS: Add the CompareTemporalTime & CompareISODateTime AOs
...
These are required for implementing comparisons between `PlainTime`s and
`PlainDateTime`s.
2021-08-27 16:40:16 +01:00
Linus Groh
ad427f85ca
LibJS: Implement Temporal.PlainDateTime.from()
2021-08-23 20:54:52 +01:00
Linus Groh
0cdad283c0
LibJS: Reflect Record wording editorial change in the Temporal spec
...
See: https://github.com/tc39/proposal-temporal/commit/c8f14d0
2021-08-17 21:59:35 +01:00
Andreas Kling
286a7ecd92
LibJS: Call base class visit_edges() in various Temporal objects
...
When overriding visit_edges() in a JS::Object subclass, we must make
sure to call the base class visit_edges(), or the object's Shape (and
any properties) will not get marked.
2021-08-14 20:12:22 +02:00
Linus Groh
4e4d8d6905
LibJS: Reflect infallibility editorial changes in the Temporal spec
...
See:
- https://github.com/tc39/proposal-temporal/commit/3c0671f
- https://github.com/tc39/proposal-temporal/commit/fe28b86
2021-07-28 23:48:56 +01:00
Linus Groh
ae4bf8fc32
LibJS: Start implementing Temporal.PlainTime
...
This commit adds the PlainTime object itself, its constructor and
prototype (currently empty), and the CreateTemporalTime abstract
operation.
2021-07-28 21:57:30 +01:00
Linus Groh
c303bbde54
LibJS: Implement Temporal.Now.plainDate()
...
...and ten required AOs we didn't have yet:
- BalanceISODate
- BalanceISODateTime
- BalanceISOYearMonth
- BalanceTime
- BuiltinTimeZoneGetPlainDateTimeFor
- GetISOPartsFromEpoch
- GetOffsetNanosecondsFor
- ParseTemporalTimeZone
- SystemDateTime
- ToTemporalTimeZone
2021-07-27 19:51:44 +01:00
Idan Horowitz
2c6bd3a61b
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.
2021-07-26 16:15:31 +01:00
Idan Horowitz
b816037739
LibJS: Add the ToTemporalInstant Abstract Operation & its requirements
...
This is Abstract Operation is required for the majority of
InstantConstructor's and InstantPrototype's methods.
The implementation is not entirely complete, (specifically 2 of the
underlying required abstract operations, ParseTemporalTimeZoneString
and ParseISODateTime are missing the required lexing, and as such are
TODO()-ed) but the majority of it is done.
2021-07-12 19:05:17 +01:00