Commit graph

9 commits

Author SHA1 Message Date
Timothy Flynn
7cb956d17b LibJS: Use iterative text segmentation algorithms for Intl.Segmenter
This uses the find-next and find-previous APIs instead of storing all
indices as a vector.
2023-02-16 11:18:53 +01:00
Timothy Flynn
bb4b6d8ce3 LibJS: Port Intl locale resolution to String 2023-01-19 20:57:30 +00:00
Timothy Flynn
115baa7e32 LibJS+Everywhere: Make PrimitiveString and Utf16String fallible
This makes construction of Utf16String fallible in OOM conditions. The
immediate impact is that PrimitiveString must then be fallible as well,
as it may either transcode UTF-8 to UTF-16, or create a UTF-16 string
from ropes.

There are a couple of places where it is very non-trivial to propagate
the error further. A FIXME has been added to those locations.
2023-01-08 12:13:15 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Andreas Kling
35c9aa7c05 LibJS: Hide all the constructors!
Now that the GC allocator is able to invoke Cell subclass constructors
directly via friendship, we no longer need to keep them public. :^)
2022-08-29 03:24:54 +02:00
Linus Groh
f9705eb2f4 LibJS: Replace GlobalObject with VM in Intl AOs [Part 1/19]
Instead of passing a GlobalObject everywhere, we will simply pass a VM,
from which we can get everything we need: common names, the current
realm, symbols, arguments, the heap, and a few other things.

In some places we already don't actually need a global object and just
do it for consistency - no more `auto& vm = global_object.vm();`!

This will eventually automatically fix the "wrong realm" issue we have
in some places where we (incorrectly) use the global object from the
allocating object, e.g. in call() / construct() implementations. When
only ever a VM is passed around, this issue can't happen :^)

I've decided to split this change into a series of patches that should
keep each commit down do a somewhat manageable size.
2022-08-23 13:58:30 +01:00
Idan Horowitz
96af50bbba LibJS: Implement the Intl CreateSegmentDataObject AO 2022-01-31 21:05:04 +02:00
Idan Horowitz
cea6c81c77 LibJS: Implement the Intl.Segmenter FindBoundary AO 2022-01-31 21:05:04 +02:00
Idan Horowitz
a3bc06bb23 LibJS: Start implementing Intl.Segmenter 2022-01-30 19:47:01 +00:00