Commit graph

35 commits

Author SHA1 Message Date
Timothy Flynn
a8d6e5c3db LibJS: Migrate Temporal updates to ECMA-262 AOs to the main AO file
These are going to be included in the ECMA-262 AOs once Temporal reaches
stage 4. There's no need to keep them in the Temporal namespace. Some
upcoming Temporal editorial changes will get awkward without this patch.
2025-03-01 14:49:20 +01:00
Timothy Flynn
ea52952774 LibJS: Update Date AOs to use Temporal
Neglected to do this after the Temporal rewrite. This lets us eliminate
the duplicated GetUTCEpochNanoseconds definition in Temporal.
2025-03-01 14:49:20 +01:00
Timothy Flynn
5372d07c5c LibJS: Simplify ParseTemporalCalendarString
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/1b1fd9f
2025-01-28 11:25:42 +00:00
Timothy Flynn
784e872851 LibJS: Remove errant assertion from ParseISODateTime
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/728beeb
2024-12-05 15:29:08 -05:00
Timothy Flynn
fe4995b69a LibJS: Replace invalid reference to an [[Offset]] internal slot
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/f1569ef

Here, we also update the struct member name to match the correct slot
name.
2024-12-05 15:29:08 -05:00
Timothy Flynn
ade510fe17 LibJS: Pass ISO types by value vs. const-reference more correctly
We were passing types like ISODate by reference so that they could be
used as forward-declarations. But after commit 021a5f4ded, we now have
their full definitions anywhere they're needed. So let's pass ISODate by
value everywhere consistently - it is only 8 bytes.
2024-11-26 11:35:15 -05:00
Timothy Flynn
b95528d7b5 LibJS: Stub out Temporal.ZonedDateTime.prototype.getTimeZoneTransition
We will have to add facilities to determine next/previous time zone
transitions. Ideally, ICU can provide this.
2024-11-26 11:00:56 +01:00
Timothy Flynn
4ef21614e9 LibJS: Implement stringification Temporal.ZonedDateTime prototypes 2024-11-26 11:00:56 +01:00
Timothy Flynn
18f95434bc LibJS: Implement the Temporal.Duration relative-to ZonedDateTime options 2024-11-26 11:00:56 +01:00
Timothy Flynn
8c73cae2b8 LibJS: Implement the Temporal.ZonedDateTime constructor
And the simple Temporal.ZonedDateTime.prototype getters, so that the
constructed Temporal.ZonedDateTime may actually be validated.
2024-11-26 11:00:56 +01:00
Timothy Flynn
615ad70030 LibJS: Implement stringification Temporal.Instant prototypes 2024-11-25 13:32:58 +01:00
Timothy Flynn
90820873a2 LibJS: Implement the Temporal.Instant constructor
And the simple Temporal.Instant.prototype getters, so that the
constructed Temporal.Instant may actually be validated.
2024-11-25 13:32:58 +01:00
Timothy Flynn
029b6ad1a8 LibJS: Implement the Temporal.PlainDateTime constructor
And the simple Temporal.PlainDateTime.prototype getters, so that the
constructed Temporal.PlainDateTime may actually be validated.
2024-11-24 11:43:59 +01:00
Timothy Flynn
66365fef57 LibJS: Implement the Temporal.PlainTime constructor
And the simple Temporal.PlainTime.prototype getters, so that the
constructed Temporal.PlainTime may actually be validated.
2024-11-23 19:35:36 -05:00
Timothy Flynn
7f3de3be9c LibJS: Capture sub-second nanoseconds as a u64 in FormatTimeString
This is not a plain nanosecond value (which has a range of [0, 999]).
Rather, it is all of the sub-second components added together.
2024-11-23 19:35:36 -05:00
Timothy Flynn
0b59971ef9 LibJS: Reject ambiguous annotated time strings
This missing rejection will be caught by an upcoming Temporal.PlainTime
test.
2024-11-23 19:35:36 -05:00
Timothy Flynn
c83a3db542 LibJS: Handle Temporal.PlainDate in dynamic calendar operations 2024-11-23 19:35:36 -05:00
Timothy Flynn
06593b1894 LibJS: Implement most of GetTemporalRelativeToOption
Now that we have the Temporal.PlainDate object, we can flesh out this AO
for such relative-to objects.
2024-11-23 14:46:00 +01:00
Timothy Flynn
021a5f4ded LibJS: Move ISO-related structures to their own file
Currently, AbstractOperations.h needs to include Time.h for the Time
structure. Soon, Time.h will need to include AbstractOperations.h for
structures defined there. To avoid a circular include, let's put the
ISO types into their own file, so that AO.h does not need to include
any JS type header.
2024-11-23 14:46:00 +01:00
Timothy Flynn
abc6b679c3 LibJS: Check both the quotient and remainder for rounding negativity
Our BigInt implementation can store the negativity of the division
result in either the quotient or the remainder. This is exposed by an
upcoming prototype, which will reach this division with:

    -432000000000000 / 86400000000000000000000

Which has the BigInt division result:

    quotient = 0
    remainder = -432000000000000

(Our old Temporal implementation also had this bug).
2024-11-23 14:46:00 +01:00
Timothy Flynn
cb5d1b5086 LibJS: Implement Temporal.PlainYearMonth.prototype.until/since 2024-11-22 19:55:24 +01:00
Timothy Flynn
b68d67693e LibJS: Implement the Temporal.PlainYearMonth constructor
And the simple Temporal.PlainYearMonth.prototype getters, so that the
constructed Temporal.PlainYearMonth may actually be validated.
2024-11-22 19:55:24 +01:00
Timothy Flynn
c6fccc04e1 LibJS: Use Temporal's ISO8601 parser to parse UTC offset strings
We now have the Temporal facilities to implement the Date AOs which
parse UTC offset strings using the ISO8601 parser. This patch updates
those AOs and their callers in accordance with the Temporal spec.
2024-11-21 19:24:25 -05:00
Timothy Flynn
5389acc231 LibJS: Implement Temporal.PlainMonthDay.prototype.with/equals 2024-11-21 19:24:25 -05:00
Timothy Flynn
5bccb36a6f LibJS: Implement stringification Temporal.PlainMonthDay prototypes 2024-11-21 19:24:25 -05:00
Timothy Flynn
1a386e78c3 LibJS: Implement the Temporal.PlainMonthDay constructor
And the simple Temporal.PlainMonthDay.prototype getters, so that the
constructed Temporal.PlainMonthDay may actually be validated.
2024-11-21 19:24:25 -05:00
Timothy Flynn
5689621c2b LibJS: Implement Temporal.Duration.prototype.round
Until we have re-implemented Temporal.PlainDate/ZonedDateTime, some of
Temporal.Duration.prototype.round (and its invoked AOs) are left
unimplemented.
2024-11-20 19:04:30 -05:00
Timothy Flynn
4742775262 LibJS: Implement stringification Temporal.Duration prototypes 2024-11-20 19:04:30 -05:00
Timothy Flynn
a80523be18 LibJS: Implement mathematical Temporal.Duration prototypes
Includes:
Temporal.Duration.prototype.negated
Temporal.Duration.prototype.abs
Temporal.Duration.prototype.add
Temporal.Duration.prototype.subtract
2024-11-20 19:04:30 -05:00
Timothy Flynn
5fe0d3352d LibJS: Implement the Temporal.Duration constructor
This also includes a stubbed Temporal.Duration.prototype.

Until we have re-implemented Temporal.PlainDate/ZonedDateTime, some of
Temporal.Duration.compare (and its invoked AOs) are left unimplemented.
2024-11-20 19:04:30 -05:00
Timothy Flynn
e4e05837e1 LibJS: Return a GC::Ref from Temporal::get_options_object
The Object returned here is always non-null.
2024-11-20 19:04:30 -05:00
Timothy Flynn
c8d2404230 LibJS: Update spec steps for the few remaining Temporal AOs 2024-11-20 19:04:30 -05:00
Timothy Flynn
f7517c5b8d LibJS: Remove our existing Temporal implementation
Our Temporal implementation is woefully out of date. The spec has been
so vastly rewritten that it is unfortunately not practical to update our
implementation in-place. Even just removing Temporal objects that were
removed from the spec, or updating any of the simpler remaining objects,
has proven to be a mess in previous attempts.

So, this removes our Temporal implementation. AOs used by other specs
are left intact.
2024-11-20 19:04:30 -05:00
Shannon Booth
f87041bf3a LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
2024-11-15 14:49:20 +01:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp (Browse further)