Timothy Flynn
d6e926e5b1
LibJS: Support BigInt number formatting with Intl.NumberFormat
2022-01-30 20:05:27 +00:00
Timothy Flynn
a0253af8c1
LibJS: Generalize Intl.NumberFormat to operate on Value types
...
Intl.NumberFormat is meant to format both Number and BigInt types. To
prepare for formatting BigInt types, this generalizes our NumberFormat
implementation to operate on Value instances rather than doubles. All
arithmetic is moved to static helpers that can now be updated with
BigInt semantics.
2022-01-30 20:05:27 +00:00
Idan Horowitz
4ba4e4c777
LibJS: Implement Intl %SegmentsPrototype%[@@iterator]
2022-01-30 19:47:01 +00:00
Idan Horowitz
6c26a02aa8
LibJS: Start implementing Intl Segment Iterator objects
2022-01-30 19:47:01 +00:00
Idan Horowitz
9001a8cbe1
LibJS: Implement Intl.Segmenter.prototype.segment
2022-01-30 19:47:01 +00:00
Idan Horowitz
bbacea255f
LibJS: Start implementing Intl Segments objects
2022-01-30 19:47:01 +00:00
Idan Horowitz
891dfd9cbb
LibJS: Implement Intl.Segmenter.prototype.resolvedOptions
2022-01-30 19:47:01 +00:00
Idan Horowitz
6b8dfefc20
LibJS: Implement Intl.Segmenter.supportedLocalesOf
2022-01-30 19:47:01 +00:00
Idan Horowitz
a3bc06bb23
LibJS: Start implementing Intl.Segmenter
2022-01-30 19:47:01 +00:00
davidot
6b5c882af3
LibJS: Add support for JSON modules
...
We now have one supported assertion: 'type' if that is 'json' we attempt
to parse the module as JSON.
2022-01-30 17:40:20 +00:00
davidot
202de6ed25
LibJS: Expose JSON.parse as an intrinsic value of the global object
...
This will allow us to safely call it if we need to parse JSON within
LibJS.
2022-01-30 17:40:20 +00:00
davidot
f568939568
LibJS: Implement the import assertions proposal
...
The hard part of parsing them in import statements and calls was already
done so this is just removing some check which threw before on
assertions. And filtering the assertions based on the result of a new
host hook.
2022-01-30 17:40:20 +00:00
Idan Horowitz
fe687412a6
LibJS: Visit m_async_from_sync_iterator_prototype in GlobalObject
...
This prevents random crashes in for async loops due to GC.
2022-01-29 22:35:43 +00:00
Timothy Flynn
3b2ec01038
LibJS: Update spec numbers for ECMA-402
...
Intl.Segmenter is now section 18; bump the "Locale Sensitive Functions".
2022-01-29 22:23:25 +00:00
Timothy Flynn
4a99170cd2
LibJS: Implement Intl.Collator.prototype.resolvedOptions
2022-01-29 20:27:24 +00:00
Timothy Flynn
17306078b5
LibJS: Implement Intl.Collator.supportedLocalesOf
2022-01-29 20:27:24 +00:00
Timothy Flynn
06a6100b12
LibJS: Implement the Intl.Collator constructor
2022-01-29 20:27:24 +00:00
Timothy Flynn
1607a05d4c
LibJS: Add co, kf, and kn Unicode locale keywords to ResolveLocale
2022-01-29 20:27:24 +00:00
Timothy Flynn
4a3e142d55
LibJS: Implement a nearly empty Intl.Collator object
...
This adds plumbing for the Intl.Collator object, constructor, and
prototype.
2022-01-29 20:27:24 +00:00
Timothy Flynn
74939eb943
LibJS: Implement Intl.PluralRules.prototype.resolvedOptions
2022-01-28 19:38:47 +00:00
Timothy Flynn
8b3f49ff84
LibJS: Implement Intl.PluralRules.supportedLocalesOf
2022-01-28 19:38:47 +00:00
Timothy Flynn
348059bffd
LibJS: Implement the Intl.PluralRules constructor
2022-01-28 19:38:47 +00:00
Timothy Flynn
0087804d10
LibJS: Implement a nearly empty Intl.PluralRules object
...
This adds plumbing for the Intl.PluralRules object, constructor, and
prototype.
2022-01-28 19:38:47 +00:00
Timothy Flynn
ac3e42a8de
LibJS: Move some Intl.NumberFormat fields into a NumberFormatBase class
...
Other Intl objects, such as PluralRules, are to be treated as a
NumberFormat object in some AOs. There's only a handful of fields which
are to be shared between those objects - move them to a base class for
shared reuse.
This also updates the couple of NumberFormat AOs that are meant to
operate on these NumberFormat-like objects.
Alternatively, we could just have objects like PluralRules inherit from
NumberFormat directly. But that messes up the is<NumberFormat> runtime
checks, so this feels safer.
2022-01-28 19:38:47 +00:00
Timothy Flynn
a2e791277e
LibJS: Implement Intl.RelativeTimeFormat.prototype.formatToParts
2022-01-27 21:16:44 +00:00
Timothy Flynn
9c5d7e515c
LibJS: Implement Intl.RelativeTimeFormat.prototype.format
2022-01-27 21:16:44 +00:00
Timothy Flynn
8098eb273a
LibJS: Add explicit constructors for PatternPartition
...
This is to enable emplacing this struct in containers. GCC is fine with
emplacing without this constructor, but Clang raises an error.
2022-01-27 21:16:44 +00:00
Timothy Flynn
236fd0a2cb
LibJS: Change RelativeTimeFormat::number_format to return a reference
...
In the one place this will be used, we will know that the NumberFormat
object is non-null. So return a reference, as the AO it is passed off to
also expects a reference.
2022-01-27 21:16:44 +00:00
Timothy Flynn
90e68bca6a
LibJS: Add missing spec link for InitializeRelativeTimeFormat
2022-01-27 21:16:44 +00:00
Timothy Flynn
cf92bc42a2
LibJS: Respect per-locale minimum grouping digits when number formatting
2022-01-27 20:30:52 +00:00
Timothy Flynn
236025df19
LibJS: Prevent implicit pointer-to-bool conversion in Value constructor
...
For example, say you try to create a Value from an Array and forgot to
include LibJS/Runtime/Array.h. This would cause the boolean constructor
to be used instead of a compile error.
2022-01-27 16:27:00 +00:00
Timothy Flynn
59ca435172
LibJS: Use new construct AO overload where easily applicable
2022-01-25 22:09:13 +00:00
Timothy Flynn
67e02f6ca6
LibJS: Add templated overloads for the construct AO to create its MVL
...
Instead of requiring callers to construct a MarkedValueList, add a
variadic templated overload to construct the MVL on the caller's behalf.
2022-01-25 22:09:13 +00:00
Timothy Flynn
4661a0f228
LibJS: Use forwarding references for call's variadic template arguments
2022-01-25 22:09:13 +00:00
Timothy Flynn
5c4b1e3d23
LibJS: Remove erroneous variadic template from some call overloads
...
These function do not use the Args variadic template.
2022-01-25 22:09:13 +00:00
Timothy Flynn
0c630d5687
LibJS: Implement Intl.RelativeTimeFormat.prototype.resolvedOptions
2022-01-25 19:02:59 +00:00
Timothy Flynn
cf166c1d93
LibJS: Implement Intl.RelativeTimeFormat.supportedLocalesOf
2022-01-25 19:02:59 +00:00
Timothy Flynn
a2e31ed736
LibJS: Implement the Intl.RelativeTimeFormat constructor
2022-01-25 19:02:59 +00:00
Timothy Flynn
79fdec85de
LibJS: Implement a nearly empty Intl.RelativeTimeFormat object
...
This adds plumbing for the Intl.RelativeTimeFormat object, constructor,
and prototype.
2022-01-25 19:02:59 +00:00
Timothy Flynn
0865f71d37
LibJS: Convert Intl.NumberFormat to use Unicode::Style
2022-01-25 19:02:59 +00:00
Timothy Flynn
25e67f63a2
LibJS: Convert Intl.DisplayNames to use Unicode::Style
2022-01-25 19:02:59 +00:00
Timothy Flynn
bced4e9324
LibJS+LibUnicode: Convert Intl.ListFormat to use Unicode::Style
...
Remove ListFormat's own definition of the Style enum, which was further
duplicated by a generated ListPatternStyle enum with the same values.
2022-01-25 19:02:59 +00:00
Linus Groh
96db8a061b
LibJS: Correct FormatTimeZoneOffsetString arg in CreateTemporalTimeZone
...
This is an editorial change in the Temporal spec (accidentally marked
normative).
See: 3039c98
2022-01-25 00:06:49 +00:00
Sam Atkins
45cf40653a
Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr
...
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
2022-01-24 22:36:09 +01:00
Linus Groh
73a43e7cba
LibJS: Update ShadowRealm AO parameter declaration notations
...
This is an editorial change in the ShadowRealm spec.
See: f5013fe
2022-01-24 20:17:07 +00:00
Linus Groh
e20efaa083
LibJS: Let WrappedFunction inherit target name and length
...
This is a normative change in the ShadowRealm spec.
See: b73a1dc
2022-01-24 20:17:07 +00:00
Linus Groh
886d6c62f9
LibJS: Implement the SetFunctionLength AO
2022-01-24 20:17:07 +00:00
Linus Groh
5b04c49762
LibJS: Implement the SetFunctionName AO
2022-01-24 20:17:07 +00:00
Idan Horowitz
ace36681ff
LibJS+LibIMAP: Use the new Optional<U>(Optional<T>) constructor
...
These look much nicer than these repeated ternaries :^)
2022-01-23 18:53:42 +02:00
mjz19910
61cf1c066e
LibJS: Remove VM::call()
2022-01-23 15:24:45 +00:00