davidot
791855deab
LibCrypto+LibJS: Remove the create_from methods from BigInteger
...
Instead we just use a specific constructor. With this set of
constructors using curly braces for constructing is highly recommended.
As then it will not do too many implicit conversions which could lead to
unexpected loss of data or calling the much slower double constructor.
Also to ensure we don't feed (Un)SignedBigInteger infinities we throw
RangeError earlier for Durations.
2022-08-26 19:18:26 +01:00
Linus Groh
36225c0ae7
LibJS: Allow undefined for calendar in MaybeFormatCalendarAnnotation
...
This is an editorial change in the Temporal spec.
Now that this is spec'd as either an Object or undefined, we can change
the parameter type from arbitrary JS::Value to JS::Object*.
See: https://github.com/tc39/proposal-temporal/commit/cdfcffd
2022-08-25 23:41:09 +01:00
Luke Wilde
54bb6bf2c0
LibJS: Avoid calling ToString on calendar when calendarName is "never"
...
This is a normative change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/6122f4e
- https://github.com/tc39/proposal-temporal/commit/cf586bc
2022-08-25 21:11:23 +01:00
Linus Groh
b345a0acca
LibJS+LibWeb: Reduce use of GlobalObject as an intermediary
...
- Prefer VM::current_realm() over GlobalObject::associated_realm()
- Prefer VM::heap() over GlobalObject::heap()
- Prefer Cell::vm() over Cell::global_object()
- Prefer Wrapper::vm() over Wrapper::global_object()
- Inline Realm::global_object() calls used to access intrinsics as they
will later perform a direct lookup without going through the global
object
2022-08-23 13:58:30 +01:00
Linus Groh
25849f8a6d
LibJS: Replace GlobalObject with VM in common AOs [Part 18/19]
2022-08-23 13:58:30 +01:00
Linus Groh
a022e548b8
LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]
...
This is where the fun begins. :^)
2022-08-23 13:58:30 +01:00
Linus Groh
694f66b5ca
LibJS: Replace GlobalObject with VM in Temporal AOs [Part 2/19]
2022-08-23 13:58:30 +01:00
Linus Groh
f3117d46dc
LibJS: Remove GlobalObject from VM::throw_completion()
...
This is a continuation of the previous five commits.
A first big step into the direction of no longer having to pass a realm
(or currently, a global object) trough layers upon layers of AOs!
Unlike the create() APIs we can safely assume that this is only ever
called when a running execution context and therefore current realm
exists. If not, you can always manually allocate the Error and put it in
a Completion :^)
In the spec, throw exceptions implicitly use the current realm's
intrinsics as well: https://tc39.es/ecma262/#sec-throw-an-exception
2022-08-23 13:58:30 +01:00
Idan Horowitz
d35d106f01
LibJS: Remove invalid CreateDateDurationRecord AO overload
2022-07-20 21:07:49 +01:00
Linus Groh
fb2012dfc7
LibJS: Add Add IsValidISODate assertions
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/46f97ea
2022-07-10 01:22:34 +02:00
Linus Groh
fec5d8d531
LibJS: Consistently check Temporal overflow options
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/c8ee2bd
2022-07-05 23:15:52 +02:00
Linus Groh
f5669a1373
LibJS: Mark CreateTemporalDate as infallible in DifferenceISODateTime
...
This is an editorial change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/af2dc2f
- https://github.com/tc39/proposal-temporal/commit/2e9ee68
2022-06-29 07:35:42 +01:00
Linus Groh
abb3f327ad
LibJS: Mark BalanceDuration as infallible in DifferenceISODateTime
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/5fefc2f
2022-06-29 07:35:42 +01:00
Linus Groh
cee54d2725
LibJS: Replace one use of BalanceISODate with CreateISODateRecord
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/7a7ddb7
2022-06-29 07:35:42 +01:00
Linus Groh
6eab1f0212
LibJS: Assert DifferenceISODateTime is called with valid datetime values
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/143b2e2
2022-06-29 07:35:42 +01:00
Linus Groh
4ba1018273
LibJS: Replace guaranteed zero [[Days]] field with constant zero
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/68f2802
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
05c5263ecc
LibJS: Mark CreateTemporalDate in AddDateTime as infallible
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/cd356a6
2022-06-24 22:12:03 +01:00
Linus Groh
709e16004d
LibJS: Assert RoundISODateTime is called with values within the limits
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/eaa7042
2022-06-24 22:12:03 +01:00
Linus Groh
52a4ee563d
LibJS: Assume options is an object in the MergeLargestUnitOption AO
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/20a04ac
2022-06-15 17:49:20 +01:00
Linus Groh
8be4cc9653
LibJS: Make options mandatory in Difference{Zoned,ISO}DateTime
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/d4c4a16
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
3e6561c75f
LibJS: Fold PreparePartialTemporalFields into PrepareTemporalFields
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/6ed1835
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
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
de0ea331cd
LibJS: Simplify BalanceISODate
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/9544573
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
f7c9bd0760
LibJS: Convert remaining Date AOs using JS::Value as in/output to double
...
There was an awful lot of JS::Value <-> double conversion going on, even
through these AOs only work with number values anyway.
They don't need a global object either as they won't allocate or throw,
that was simply to pass it to infallible calls of ToIntegerOrInfinity.
2022-05-06 22:32:47 +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
76a6bd0e75
LibJS: Fix numeric type confusion in GetEpochFromISOParts return value
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/2a59eac
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
2499911898
LibJS: Rename DateFromFields to CalendarDateFromFields, etc
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/fd27b54
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
e109b967a1
LibJS: Make options object const in more Temporal AOs
2022-04-08 00:43:17 +01:00
Linus Groh
2844a2c448
LibJS: Handle undefined options in MergeLargestUnitOption
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/5e161a2
2022-04-08 00:43:17 +01:00
Linus Groh
151eb8606d
LibJS: Consistently call observable Temporal AOs with undefined options
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/6fa5b9d
2022-04-07 12:58:39 +01:00
Idan Horowitz
086969277e
Everywhere: Run clang-format
2022-04-01 21:24:45 +01:00
Linus Groh
cfb04765fa
LibJS: Correct PlainYearMonth arithmetic for non-ISO calendars
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/61e8dd0
2022-03-31 17:09:10 +01:00
Linus Groh
360c65e92b
LibJS: Change balance_duration() nanoseconds from a JS to Crypto BigInt
...
Similar to the preceding commit.
2022-03-19 19:28:49 +00:00
Linus Groh
68af8649fb
LibJS: Follow rules for consuming completion records
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/1c19b96
2022-03-10 23:20:39 +01:00
Linus Groh
4ceff91893
LibJS: Use different variable name in DifferenceISODateTime
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/c32cc4d
2022-03-10 23:20:39 +01: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
Timothy Flynn
1039159a6c
LibJS: Change LargerOfTwoTemporalUnits AO to return a StringView
2021-11-30 00:01:07 +00:00
Linus Groh
a20b189eab
LibJS: Fix incorrectly formatted section comments
...
A couple of missing URLs, spaces, and a stray comma.
2021-11-24 17:37:27 +00:00
Luke Wilde
29072f4b09
LibJS: Implement the required AOs for Temporal.Duration.compare
2021-11-11 21:06:54 +00:00
Linus Groh
36b51276d5
LibJS: Change calendar_date_add() date parameter from PlainDate to Value
...
Turns out use of this AO is a bit more flexible than I anticipated.
2021-11-07 15:31:28 +01:00