Commit graph

57 commits

Author SHA1 Message Date
Idan Horowitz
d35d106f01 LibJS: Remove invalid CreateDateDurationRecord AO overload 2022-07-20 21:07:49 +01:00
Linus Groh
11a6702cef LibJS: Assert [[Days]] is zero for the balanced time in DifferenceTime
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/be982fb
2022-06-29 07:35:42 +01:00
Linus Groh
ee0d5d6649 LibJS: Refactor common option reading into the GetDifferenceSettings AO
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/78abbb8
2022-06-24 22:12:03 +01:00
Linus Groh
f54ed48ef1 LibJS: Assert AddTime is called with a valid time
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0ead23c
2022-06-24 22:12:03 +01:00
Linus Groh
98dc964649 LibJS: Add conversion to mathematical number in ToTemporalTimeRecord
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/9f37d10
2022-06-24 22:12:03 +01:00
Linus Groh
1755d051fd LibJS: Mark two calls as infallible in DifferenceTemporalPlainTime
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0e4966a
2022-06-15 17:49:20 +01:00
Linus Groh
690585323d LibJS: Prefer Else + Assertion over If for constrained values
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/2088eaa
2022-06-15 17:49:20 +01:00
Linus Groh
e96df3b7a7 LibJS: Leverage PrepareTemporalFields in ToTemporalTimeRecord
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/b5ba981
2022-06-15 17:49:20 +01:00
Linus Groh
9bcd88828f LibJS: Fold ToPartialTime into ToTemporalTimeRecord
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/58e476d
2022-06-15 17:49:20 +01:00
Linus Groh
03f48056d5 LibJS: Mark various uses of CreateTemporalTime as infallible
These are editorial changes in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/dd35d5e
- https://github.com/tc39/proposal-temporal/commit/1ec6673
- https://github.com/tc39/proposal-temporal/commit/8c04e3b
- https://github.com/tc39/proposal-temporal/commit/df7a802
- https://github.com/tc39/proposal-temporal/commit/5fc71ae
- https://github.com/tc39/proposal-temporal/commit/ca305c6
2022-06-15 17:49:20 +01:00
Linus Groh
4c77575ec5 LibJS: Simplify Temporal unit AOs
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/1b3d018
2022-06-10 12:39:11 +02:00
Linus Groh
ae1fdf299d LibJS: Use the rounding abstract operations from Intl.NumberFormat V3
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/75279e5

Co-Authored-By: Idan Horowitz <idan.horowitz@gmail.com>
2022-05-25 00:25:23 +01:00
Linus Groh
cf1ea18b7f LibJS: Align DifferenceTemporalPlainTime with other Difference* AOs
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/70f739d
2022-05-25 00:25:23 +01:00
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