Brian Gianforcaro
bffc29ae34
LibJS: Fix uninitialized member variable in DurationFormat
...
Reported-by: PVS Studio
2023-01-16 09:45:46 +01:00
Timothy Flynn
afeb7273cc
LibJS+Everywhere: Rename Value::to_string to to_deprecated_string
2023-01-15 01:00:20 +00:00
Timothy Flynn
8a88d4434f
LibJS+LibWeb: Rename number_to_string to number_to_deprecated_string
2023-01-15 01:00:20 +00:00
Timothy Flynn
0ddc2e1f50
LibCrypto+Everywhere: Rename *BigInteger::to_base to to_base_deprecated
2023-01-15 01:00:20 +00:00
Timothy Flynn
822e32eb11
LibJS: Reword and reorder some steps of the Intl ResolveLocale AO
...
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/4c55823
2023-01-14 19:12:48 +00:00
Timothy Flynn
0ff4d8100f
LibJS: Consistently use spaces / parentheses in NumberFormat operations
...
These are editorial changes in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/1508825
https://github.com/tc39/ecma402/commit/760f23a
2023-01-14 19:12:48 +00:00
Timothy Flynn
0ffad2a2d1
LibJS: Refer to String elements as code units rather than characters
...
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/d6b3435
2023-01-14 19:12:48 +00:00
Timothy Flynn
95cef87a9c
LibJS: Update syntax for invoking the GetOption AO from Intl objects
...
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/0ac2e10
2023-01-14 19:12:48 +00:00
Timothy Flynn
2cca5d6676
LibJS: Fix assignment of "isNegative" in FormatNumericToString
...
These are normative changes in the Intl.NumberFormat v3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/5a2b1d1
https://github.com/tc39/proposal-intl-numberformat-v3/commit/cd48a3d
2023-01-14 19:12:48 +00:00
Timothy Flynn
d30e96a209
LibJS: Renumber Intl.NumberFormat v3 prototypes and AOs
...
These are editorial changes in the Intl.NumberFormat v3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/82e2f92
https://github.com/tc39/proposal-intl-numberformat-v3/commit/ce6c33e
https://github.com/tc39/proposal-intl-numberformat-v3/commit/b982783
https://github.com/tc39/proposal-intl-numberformat-v3/commit/96010f4
https://github.com/tc39/proposal-intl-numberformat-v3/commit/9dd123f
https://github.com/tc39/proposal-intl-numberformat-v3/commit/0c2834f
https://github.com/tc39/proposal-intl-numberformat-v3/commit/31c72f3
2023-01-14 19:12:48 +00:00
Timothy Flynn
d1881da2be
LibJS: Set approximate number range format result's "source" to "shared"
...
This is a normative change in the Intl.NumberFormat v3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/7510e7f
2023-01-14 19:12:48 +00:00
Timothy Flynn
a59ebdac2d
LibJS+Everywhere: Return strings by value from PrimitiveString
...
It turns out return a ThrowCompletionOr<T const&> is flawed, as the GCC
expansion trick used with TRY will always make a copy. PrimitiveString
is luckily the only such use case.
2023-01-13 18:50:47 -05:00
Timothy Flynn
d0403ec14f
AK+Everywhere: Rename Utf16View::to_utf8 to to_deprecated_string
...
A subsequent commit will add to_utf8 back to create an AK::String.
2023-01-09 23:00:24 +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
Timothy Flynn
d793262beb
AK+Everywhere: Make UTF-16 to UTF-8 converter fallible
...
This could fail to allocate the underlying storage needed to store the
UTF-8 data. Propagate this error.
2023-01-08 12:13:15 +01:00
Timothy Flynn
2dfa87814e
LibJS: Update spec comments for replacing digits in Intl.NumberFormat
...
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/06d95ed
Note the new spec steps basically match our implementation in LibLocale.
2022-12-15 16:24:29 +00:00
Timothy Flynn
01fc025e9d
LibJS: Fix a typo in an Intl.DateTimeFormat spec comment
...
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/078bea0
2022-12-15 16:24:29 +00:00
Linus Groh
bd40464195
LibJS: Convert standalone construct() to NonnullGCPtr
2022-12-15 06:56:37 -05:00
Linus Groh
6ae79a84df
LibJS: Convert Object::construct() to NonnullGCPtr
2022-12-15 06:56:37 -05:00
Linus Groh
1c24b82dd7
LibJS: Convert ordinary_create_from_constructor() to NonnullGCPtr
2022-12-15 06:56:37 -05:00
Linus Groh
22089436ed
LibJS: Convert Heap::allocate{,_without_realm}() to NonnullGCPtr
2022-12-15 06:56:37 -05:00
Timothy Flynn
a2cf026b30
LibJS: Throw a RangeError when when formatting strings in DurationFormat
...
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/2546080
2022-12-15 09:40:09 +00:00
Timothy Flynn
010888acec
LibJS: Access DurationRecord properties in alphabetical order
...
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/42e99b8
2022-12-15 09:40:09 +00:00
Timothy Flynn
85f079dc6b
LibJS: Move IsValidDurationRecord check to ToDurationRecord
...
This is an editorial change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/fb21723
2022-12-15 09:40:09 +00:00
Timothy Flynn
0086a3acdb
LibJS: Remove infallibility markers from some Intl.DurationFormat AOs
...
This is an editorial change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/fa2b3d0
2022-12-15 09:40:09 +00:00
Timothy Flynn
897c7f7cc2
LibJS: Set DateTimeFormat's time zone when the CLDR download is disabled
...
We return early from the DateTimeFormat constructor to avoid crashing on
assertions when the CLDR is disabled. However, after commit 019211b , the
spec now mandates we assert the time zone identifier is valid. The early
return resulted in this identifier being an empty string.
2022-12-14 15:24:48 +00:00
Andreas Kling
4abdb68655
LibJS: Remove Object(Object& prototype) footgun
...
This constructor was easily confused with a copy constructor, and it was
possible to accidentally copy-construct Objects in at least one way that
we dicovered (via generic ThrowCompletionOr construction).
This patch adds a mandatory ConstructWithPrototypeTag parameter to the
constructor to disambiguate it.
2022-12-14 15:11:57 +01:00
Linus Groh
ddc6e139a6
LibJS: Convert Object::create() to NonnullGCPtr
2022-12-14 09:59:45 +00:00
Linus Groh
237402aea9
LibJS: Convert Intl::Segments::create() to NonnullGCPtr
2022-12-14 09:59:45 +00:00
Linus Groh
df589bb05b
LibJS: Convert Intl::SegmentIterator::create() to NonnullGCPtr
2022-12-14 09:59:45 +00:00
Linus Groh
658bd2f342
LibJS: Convert Intl::NumberFormatFunction::create() to NonnullGCPtr
2022-12-14 09:59:45 +00:00
Linus Groh
b2034c59dc
LibJS: Convert Intl::Locale::create() to NonnullGCPtr
2022-12-14 09:59:45 +00:00
Linus Groh
81d5bbcb04
LibJS: Convert Intl::DateTimeFormatFunction::create() to NonnullGCPtr
2022-12-14 09:59:45 +00:00
Linus Groh
46acce5142
LibJS: Convert Intl::CollatorCompareFunction::create() to NonnullGCPtr
2022-12-14 09:59:45 +00:00
Linus Groh
91b0123eaf
LibJS: Convert Array::create{,_from}() to NonnullGCPtr
2022-12-14 09:59:45 +00:00
Linus Groh
525f22d018
LibJS: Replace standalone js_string() with PrimitiveString::create()
...
Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
2022-12-07 16:43:06 +00:00
Linus Groh
5db38d7ba1
LibJS: Replace standalone js_bigint() with BigInt::create()
...
Three standalone Cell creation functions remain in the JS namespace:
- js_bigint()
- js_string()
- js_symbol()
All of them are leftovers from early iterations when LibJS still took
inspiration from JSC, which itself has jsString(). Nowadays, we pretty
much exclusively use static create() functions to construct types
allocated on the JS heap, and there's no reason to not do the same for
these.
Also change the return type from BigInt* to NonnullGCPtr<BigInt> while
we're here.
This is patch 1/3, replacement of js_string() and js_symbol() follow.
2022-12-07 16:43:06 +00:00
Linus Groh
57dc179b1f
Everywhere: Rename to_{string => deprecated_string}() where applicable
...
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.
One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +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
Timothy Flynn
675e5bfdce
LibJS: Allow specifying only roundingIncrement in NumberFormat options
...
This is a normative change in the Intl.NumberFormat v3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/a260aa3
2022-11-29 10:24:44 +01:00
Timothy Flynn
e86e59699d
LibJS: Use Object's new deferred instrinsic storage for GlobalObject
2022-11-26 09:36:22 +01:00
Andreas Kling
71067cbc6c
LibJS+LibWeb: Make Runtime/AbstractOperations.h not include AST.h
...
This led to considerable fallout and many files had to be patched with
now-missing include statements.
2022-11-23 16:05:59 +00:00
Jonah
381b36b83f
LibJS/Temporal: Rename ToIntegerWithRounding to ToIntegerIfIntegral
...
This is an editorial change to the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/1dceb57
2022-11-20 11:56:56 +00:00
Timothy Flynn
421ebc2e29
LibJS: Remove workaround for Clang misalignment in MathematicalValue
...
As noted in 269a931 , this has been fixed in Clang 15.
2022-11-15 12:30:16 +00:00
Timothy Flynn
f211028252
LibJS: Change ToLocalTime to use epoch nanoseconds
...
This is an editorial change to the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/b3f9a1b
2022-11-06 01:47:37 +00:00
Timothy Flynn
9a9025dea0
LibJS: Remove infallibility marker from DefaultTimeZone invocation
...
This is an editorial change to the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/46aa5cc
Also add an ECMA-402 spec link to the DefaultTimeZone implementation, as
that definition supersedes ECMA-262.
2022-11-06 01:47:37 +00:00
Timothy Flynn
d56205f991
LibJS: Use more accurate number-to-string method in Intl.NumberFormat
...
Intl.NumberFormat only ever wants literal number-to-digits here, without
extra exponential formatting.
2022-11-04 21:12:10 +00:00
Timothy Flynn
99fc94e138
LibJS: Delegate to NumberFormat for DurationFormat unit formatting
...
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/12ba9df
2022-11-03 18:37:48 +00:00
Timothy Flynn
a5bf32018f
LibJS+LibUnicode: Add "microsecond" and "nanosecond" as sanctioned units
...
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/f627573
2022-11-03 18:37:48 +00:00
Timothy Flynn
8ff0d35386
LibJS: Format sanctioned units such that there is one unit per line
...
Much easier to manage and view diffs this way, rather than one large
single line. This will soon be the only method in this file, so there's
no concern over taking up too much vertical space here.
2022-11-03 18:37:48 +00:00