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
e3895e6c80
LibJS: Pass Realm to define_native_{accessor,function}()
...
This is needed so that the allocated NativeFunction receives the correct
realm, usually forwarded from the Object's initialize() function, rather
than using the current realm.
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
5dd5896588
LibJS+LibWeb: Replace GlobalObject with Realm in initialize() functions
...
This is a continuation of the previous commit.
Calling initialize() is the first thing that's done after allocating a
cell on the JS heap - and in the common case of allocating an object,
that's where properties are assigned and intrinsics occasionally
accessed.
Since those are supposed to live on the realm eventually, this is
another step into that direction.
2022-08-23 13:58:30 +01:00
Linus Groh
ecd163bdf1
LibJS+LibWeb: Replace GlobalObject with Realm in object constructors
...
No functional changes - we can still very easily get to the global
object via `Realm::global_object()`. This is in preparation of moving
the intrinsics to the realm and no longer having to pass a global
object when allocating any object.
In a few (now, and many more in subsequent commits) places we get a
realm using `GlobalObject::associated_realm()`, this is intended to be
temporary. For example, create() functions will later receive the same
treatment and are passed a realm instead of a global object.
2022-08-23 13:58:30 +01: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
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
f0523aa098
LibJS: Use MUST() instead of TRY() for two infallible Temporal AOs
...
These were incorrectly used during the conversion from exception checks
to completions.
2022-04-04 19:04:07 +01:00
Linus Groh
83e8dfae38
LibJS: Use AK::Time in system_utc_epoch_nanoseconds()
...
This also uses <time.h> APIs internally, but wraps them in a much nicer
interface.
2022-04-03 01:10:31 +01:00
Linus Groh
e087cd574e
LibJS: Rename variables to 'calendarLike' in a couple of places
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/9af2d35
2022-02-04 20:00:34 +00:00
Linus Groh
df67f4978e
LibJS: Convert Temporal.Now functions to ThrowCompletionOr
2021-10-21 22:31:09 +01:00
Idan Horowitz
40eb3a39d4
LibJS: Rename define_native_function => define_old_native_function
...
This method will eventually be removed once all native functions are
converted to ThrowCompletionOr
2021-10-20 12:27:19 +01:00
Idan Horowitz
20163c0584
LibJS: Add ThrowCompletionOr versions of the JS native function macros
...
The old versions were renamed to JS_DECLARE_OLD_NATIVE_FUNCTION and
JS_DEFINE_OLD_NATIVE_FUNCTION, and will be eventually removed once all
native functions were converted to the new format.
2021-10-20 12:27:19 +01:00
Linus Groh
4d5bd092ea
LibJS: Use MUST() where applicable
2021-10-03 20:14:03 +01:00
Linus Groh
6bdd62b51b
LibJS: Convert Now AOs to ThrowCompletionOr
2021-09-17 23:43:01 +02:00
Linus Groh
35bba1c98d
LibJS: Convert PlainDate AOs to ThrowCompletionOr
2021-09-17 23:43:01 +02: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
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
1822b2938e
LibJS: Convert ZonedDateTime AOs to ThrowCompletionOr
2021-09-16 13:53:37 +01:00
Linus Groh
312946059b
LibJS+Spreadsheet: Use js_string(VM&, ...) overload more
2021-08-08 21:32:58 +01:00
Linus Groh
16c38788c3
LibJS: Add missing spec links
2021-08-08 11:04:30 +01:00
Linus Groh
a06bd451d4
LibJS: Implement Temporal.Now.zonedDateTimeISO()
2021-08-01 20:31:31 +01:00
Linus Groh
36c79c2989
LibJS: Implement Temporal.Now.zonedDateTime()
2021-08-01 20:31:31 +01:00
Linus Groh
e511390423
LibJS: Implement Temporal.TimeZone.prototype.getPlainDateTimeFor()
2021-08-01 10:24:38 +01: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
5e64156fce
LibJS: Implement Temporal.Now.plainTimeISO()
2021-07-28 21:57:30 +01:00
Linus Groh
2aa2c56891
LibJS: Update Temporal.Now spec section numbers
...
The addition of @@toStringTag shifted them all by 1.
2021-07-28 21:57:30 +01:00
Linus Groh
af3a26f4cc
LibJS: Implement Temporal.Now.plainDateTimeISO()
2021-07-27 19:51:44 +01:00
Linus Groh
0bb19fc51c
LibJS: Implement Temporal.Now.plainDateTime()
2021-07-27 19:51:44 +01:00
Linus Groh
f2a2e8e13c
LibJS: Implement Temporal.Now.plainDateISO()
2021-07-27 19:51:44 +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
Linus Groh
ff307194f3
LibJS: Implement Temporal.Now[@@toStringTag]
2021-07-27 18:48:22 +01:00
Linus Groh
8f26f51580
LibJS: Add missing spec links to System{Instant,UTCEpochNanoseconds}
2021-07-22 21:19:40 +01:00
Linus Groh
5516ad7158
LibJS: Rename Temporal.now => Temporal.Now
...
See:
- https://github.com/tc39/proposal-temporal/commit/d0acb66
- https://github.com/tc39/proposal-temporal/commit/0097fdd
2021-07-19 00:59:26 +01:00
Linus Groh
d159938acc
LibJS: Reflect recent editorial changes in the Temporal proposal
...
See:
- https://github.com/tc39/proposal-temporal/commit/2148441
- https://github.com/tc39/proposal-temporal/commit/08c04cc
- https://github.com/tc39/proposal-temporal/commit/b77da58
2021-07-19 00:59:26 +01:00
Linus Groh
6c8f0fbb35
LibJS: Use more specific return types for some Temporal AOs
...
Instead of returning Object* we should be specific and return Instant*,
TimeZone* etc.
2021-07-14 23:50:03 +01:00
Linus Groh
b180e154aa
LibJS: Add thousands separators to nanoseconds multiplier value
...
Increases readability. Thanks to @nico for noticing this!
2021-07-07 20:01:08 +01:00
Linus Groh
3a39ff8f40
LibJS: Implement Temporal.now.instant()
2021-07-07 19:00:42 +01:00
Linus Groh
6cd16eceb3
LibJS: Implement Temporal.now.timeZone()
2021-07-07 00:42:01 +01:00
Linus Groh
7da1fcb2ef
LibJS: Add the Temporal.now namespace object
...
This will be home to various functions:
- Temporal.now.timeZone()
- Temporal.now.instant()
- Temporal.now.plainDateTime()
- Temporal.now.plainDateTimeISO()
- Temporal.now.zonedDateTime()
- Temporal.now.zonedDateTimeISO()
- Temporal.now.plainDate()
- Temporal.now.plainDateISO()
- Temporal.now.plainTimeISO()
2021-07-07 00:42:01 +01:00