Commit graph

48 commits

Author SHA1 Message Date
Timothy Flynn
ccf03316fa LibJS: Convert FilterLocales and CoerceOptionsToObject to GC::Ref
These never return nullptr.
2025-04-08 06:50:40 -04:00
Timothy Flynn
2729c88154 LibJS: Migrate remaining Intl objects to use ResolveOptions
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/75e67db
2025-04-08 06:50:40 -04:00
Timothy Flynn
3f55240a8e LibJS: Migrate Intl.DisplayNames to use ResolveOptions
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/5eafacd
2025-04-08 06:50:40 -04:00
Timothy Flynn
636e214326 LibJS: Migrate Intl.Collator to use ResolveOptions
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/f822dc1
2025-04-08 06:50:40 -04:00
Timothy Flynn
e40881ebb8 LibJS: Migrate Intl.DateTimeFormat to use ResolveOptions
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/9e4c922
2025-04-08 06:50:40 -04:00
Timothy Flynn
d3332d51b5 LibJS: Add an AO to implement Intl constructor locale resolution
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/9e4c922
2025-04-08 06:50:40 -04:00
Timothy Flynn
62793b1bd8 LibJS: Define constructor slots for describing how to read options
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/a2beb66

We implement this change by introducing a virtual interface that all
Intl "service" objects must implement. A future patch will make use of
the virtualized RelevantExtensionKeys and ResolutionOptionDescriptors
accessors, and we will need to be able to use those slots from a generic
instance type.
2025-04-08 06:50:40 -04:00
Timothy Flynn
19ce186f97 LibJS: Define Intl.Locale's LocaleExtensionKeys more declaratively
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/3898acf
2025-04-08 06:50:40 -04:00
Timothy Flynn
75fce14f09 LibJS: Rename Intl.Locale's RelevantExtensionKeys to LocaleExtensionKeys
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/e2a5747
2025-04-08 06:50:40 -04:00
Timothy Flynn
680f028bb8 LibJS: Simplify Intl.Collator sensitivity / ignorePunctuation defaults
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/23e2e92
2025-04-08 06:50:40 -04:00
Timothy Flynn
b81d0d3261 LibJS: Ensure Intl.Collator instances have [[Numeric]] and [[CaseFirst]]
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/243ec38
2025-04-08 06:50:40 -04:00
Timothy Flynn
0f1fa38442 LibJS: Update spec link for FormatNumericToString AO
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/e3f7260

Note the other changes in this commit do not apply to our implementation
as we defer to ICU for the affected steps.
2025-04-08 06:50:40 -04:00
Timothy Flynn
0a256b0a9a AK+Everywhere: Change StringView case conversions to return String
There's a bit of a UTF-8 assumption with this change. But nearly every
caller of these methods were immediately creating a String from the
resulting ByteString anyways.
2025-04-07 17:44:38 +02:00
Andreas Kling
d7908dbff5 LibJS: Change PropertyKey(ByteString) to PropertyKey(String)
...and deal with the fallout.
2025-03-24 22:27:17 +00:00
Timothy Flynn
780de1395b LibJS: Merge Intl.DurationFormat style and display fields into a struct
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/d56d624
2025-03-18 11:47:23 -04:00
Timothy Flynn
00d00b84d3 LibJS: Ensure relevant extension keys are included in ICU locale data
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/7508197

In our implementation, we don't have the affected AOs directly, as we
delegate to ICU. So instead, we must ensure we provide ICU a locale with
the relevant extension keys present.
2025-03-18 11:47:23 -04:00
Timothy Flynn
37b8ba96f1 LibJS: Use currency digits for NumberFormat only for standard notation
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/9140da2
2025-03-18 11:47:23 -04:00
Timothy Flynn
96c059bf67 LibJS: Use correct enum casing in some Intl constructors 2025-03-18 11:47:23 -04:00
Timothy Flynn
532f156f4a LibJS: Remove some single-use Intl.DurationFormat variables
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/4c139f1
https://github.com/tc39/ecma402/commit/da498c2
https://github.com/tc39/ecma402/commit/ed5c716
2025-03-04 07:36:10 -05:00
Timothy Flynn
1e462daa9b LibJS: Simplify the Intl.DurationFormat GetDurationUnitOptions AO
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/d097048
2025-03-04 07:36:10 -05:00
Timothy Flynn
2f023c2d9c LibJS: Simplify Intl.DurationFormat.prototype.resolvedOptions
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/e3d3406
2025-03-04 07:36:10 -05:00
Timothy Flynn
56a6daee4d LibJS: Standardize the spec-order of Intl.DurationFormat definitions
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/54ca35d
https://github.com/tc39/ecma402/commit/6cdcab3
https://github.com/tc39/ecma402/commit/e4cbfba
2025-03-04 07:36:10 -05:00
Timothy Flynn
aa61307392 LibJS: Re-arrange and rename a few Intl properties
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/a46e37d
https://github.com/tc39/ecma402/commit/e102741
https://github.com/tc39/ecma402/commit/67a8417
https://github.com/tc39/ecma402/commit/ecb086c
2025-03-04 07:36:10 -05:00
Timothy Flynn
8f51d1dd04 LibJS: Integrate Temporal.Duration into Intl.DurationFormat
This is a normative change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/2d97205
2025-03-01 14:49:20 +01:00
Timothy Flynn
aa737bb654 LibJS: Migrate ToIntegerIfIntegral to ECMA-262
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/5f76109
2025-03-01 14:49:20 +01:00
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
5764eeab05 LibJS: Update spec numbers for the Intl.DurationFormat proposal
This proposal has reached stage 4 and was merged into the ECMA-402 spec.
See: https://github.com/tc39/ecma402/commit/3ff3cc7
2025-03-01 14:49:20 +01:00
Timothy Flynn
97f7cb805f LibJS: Remove errant invocation to FormatNumericUnits
This is an editorial change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/cdef892
2025-02-06 10:46:04 -05:00
Timothy Flynn
313c050a61 LibJS: Do not override the timeZoneName option in Intl.DateTimeFormat
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/d76d11b
2025-01-17 10:08:06 +01:00
Timothy Flynn
27478ec7d4 Everywhere: Run clang-format
The following command was used to clang-format these files:

    clang-format-19 -i $(find . \
        -not \( -path "./\.*" -prune \) \
        -not \( -path "./Build/*" -prune \) \
        -not \( -path "./Toolchain/*" -prune \) \
        -type f -name "*.cpp" -o -name "*.mm" -o -name "*.h")
2024-12-28 05:39:32 -08:00
Andreas Kling
3bfb0534be LibGC: Rename MarkedVector => RootVector
Let's try to make it a bit more clear that this is a Vector of GC roots.
2024-12-26 19:10:44 +01:00
Timothy Flynn
0bc55424c8 LibJS: Fix variable reference in CreateDateTimeFormat
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/8acd353
2024-12-11 08:43:54 -08:00
Timothy Flynn
234f218803 LibJS: Ensure GetDateTimeFormat returns nonnull for the best format
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/8a52801
2024-12-06 11:13:10 -05:00
Timothy Flynn
7104d724ee LibJS: Simplify condition in GetDateTimeFormat
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/23c74b6
2024-12-06 11:13:10 -05:00
Timothy Flynn
5e534f4d83 LibJS+LibUnicode: Designate a sort order for Intl.PluralRules categories
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/62fe5db
2024-12-05 09:49:55 +01:00
Timothy Flynn
e5ec8441c9 LibJS: Remove the Intl.PluralRules GetOperands AO
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/c7bca3a
2024-12-05 09:49:55 +01:00
Timothy Flynn
3c64e4595a LibJS: Use exact mathematical values for Intl.DurationFormat
We can't use doubles due to precision loss for extremely large values.
2024-12-04 08:01:35 -05:00
Timothy Flynn
5cfd50224c LibJS: Use enums instead of strings in Intl.DurationFormat AOs 2024-12-04 08:01:35 -05:00
Timothy Flynn
37fc9b6511 LibJS: Apply editorial updates to Intl.DurationFormat
To help prepare for its stage 4 promotion, this applies the editorial
updates made to Intl.DurationFormat over the last few months.
2024-12-04 08:01:35 -05:00
Timothy Flynn
ea503a4f68 LibJS+LibUnicode: Integrate Temporal into Intl.DateTimeFormat
The gist is that we need to construct an ICU date-time formatter for
each possible Temporal type. This is of course going to be expensive.
So instead, we construct the configurations needed for the ICU objects
in the Intl.DateTimeFormat constructor, and defer creating the actual
ICU objects until they are needed.

Each formatting prototype can also now accept either a number (as they
already did), or any of the supported Temporal objects. These types may
not be mixed, and their properties (namely, their calendar) must align
with the Intl.DateTimeFormat object.
2024-11-29 09:52:12 +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
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
dd6acfecd4 LibJS: Don't use Temporal to parse UTC offset strings
The production for these strings has been removed from Temporal. This
implements a separate parser in accordance with the Date spec.
2024-11-18 17:46:41 -05:00
Timothy Flynn
f88826691c LibJS: Remove usage of obsolete Duration record from Intl.DurationFormat
The Duration record no longer exists in Temporal. Implement it according
to the DurationFormat spec to prepare for its removal from our Temporal
implementation.

We also implement the DurationSign AO here as well, as the Temporal
implementation will now require a Temporal.Duration JS object.
2024-11-18 17:46:41 -05:00
Timothy Flynn
59e0b7ccb7 LibJS: Remove unused Temporal inclusion from Intl 2024-11-18 17:46:41 -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
Shannon Booth
9b79a686eb LibJS+LibWeb: Use realm.create<T> instead of heap.allocate<T>
The main motivation behind this is to remove JS specifics of the Realm
from the implementation of the Heap.

As a side effect of this change, this is a bit nicer to read than the
previous approach, and in my opinion, also makes it a little more clear
that this method is specific to a JavaScript Realm.
2024-11-13 16:51:44 -05:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00