Andreas Kling
c084269e5f
LibJS: Make PrimitiveString::utf8_string() infallible
...
Work towards #20449 .
2023-08-09 17:09:16 +02:00
Andreas Kling
1a27c525d5
LibJS: Make PrimitiveString::create() infallible
...
Work towards #20449 .
2023-08-09 17:09:16 +02:00
Lucas CHOLLET
3f35ffb648
Userland: Prefer _string
over _short_string
...
As `_string` can't fail anymore (since 3434412
), there are no real
benefits to use the short variant in most cases.
2023-08-08 07:37:21 +02:00
Andreas Kling
34344120f2
AK: Make "foo"_string infallible
...
Stop worrying about tiny OOMs.
Work towards #20405 .
2023-08-07 16:03:27 +02:00
Linus Groh
b33b0d60e6
LibJS: Port Value::get_method() to GCPtr
2023-04-14 09:59:29 +02:00
Linus Groh
f345f72b55
LibJS: Port Value::to_object() to NonnullGCPtr
2023-04-14 09:59:29 +02:00
Andreas Kling
a504ac3e2a
Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
...
Let's make it clear that these functions deal with ASCII case only.
2023-03-10 13:15:44 +01:00
Linus Groh
09d40bfbb2
Everywhere: Use _{short_,}string to create Strings from literals
2023-02-25 20:51:49 +01:00
Timothy Flynn
a73b8292ed
LbJS: Convert exception-related usages of Value::TDSWOSE to String
...
TDSWOSE being to_deprecated_string_without_side_effects.
2023-02-16 14:32:22 +01:00
Timothy Flynn
b245300ba1
LibJS+Everywhere: Deprecate Value::to_string_without_side_effects
2023-02-16 14:32:22 +01:00
Timothy Flynn
c3abb1396c
LibJS+LibWeb: Convert string view PrimitiveString instances to String
...
First, this adds an overload of PrimitiveString::create for StringView.
This overload will throw an OOM completion if creating a String fails.
This is not only a bit more convenient, but it also ensures at compile
time that all PrimitiveString::create(string_view) invocations will be
handled as String and OOM-aware.
Next, this wraps all invocations to PrimitiveString::create(string_view)
with MUST_OR_THROW_OOM.
A small PrimitiveString::create(DeprecatedFlyString) overload also had
to be added to disambiguate between the StringView and DeprecatedString
overloads.
2023-02-09 17:13:33 +00:00
MacDue
63b11030f0
Everywhere: Use ReadonlySpan<T> instead of Span<T const>
2023-02-08 19:15:45 +00:00
Linus Groh
b41e7b7e86
LibJS: Replace to_deprecated_string() with to_string() in Temporal
...
Turns out all of these can already be replaced with no further changes!
2023-01-28 22:54:44 +00:00
Linus Groh
b09522312c
LibJS: Port iso_month_code() to String
2023-01-26 20:20:54 +00:00
Linus Groh
bcca5efd5a
LibJS: Port format_calendar_annotation() to String
2023-01-26 20:20:54 +00:00
Linus Groh
269f3c4105
LibJS: Port maybe_format_calendar_annotation() to String
2023-01-26 20:20:54 +00:00
Linus Groh
627291b075
LibJS: Port calendar_month_code() to String
2023-01-26 20:20:54 +00:00
Linus Groh
46cff34baf
LibJS: Port get_builtin_calendar() to String
2023-01-26 20:20:54 +00:00
Linus Groh
a101b15ad0
LibJS: Port create_temporal_calendar() to String
2023-01-26 20:20:54 +00:00
Linus Groh
ef389c086d
LibJS: Port parse_temporal_calendar_string()
...
Also make is_builtin_calendar() take a StringView as part of this, it
only does equality checks.
2023-01-26 20:20:54 +00:00
Linus Groh
227379a1da
LibJS: Port prepare_temporal_fields() and calendar_fields() to String
2023-01-26 20:20:54 +00:00
Timothy Flynn
afeb7273cc
LibJS+Everywhere: Rename Value::to_string to to_deprecated_string
2023-01-15 01:00:20 +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
BodilessSleeper
9a60d3509d
LibJS: Update ISODaysInMonth in Calendar.cpp
...
This commit ticks away a box in #15525
Temporal commit: tc39/proposal-temporal@eee1e27
2023-01-10 10:22:21 +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
BodilessSleeper
90b43712e6
LibJS: Rename ToIntegerThrowOnInfinity to ToIntegerWithTruncation
...
This commit ticks away two of the boxes in #15525
Temporal commits: tc39/proposal-temporal@f274678 and
tc39/proposal-temporal@a63a0fb
2023-01-06 11:16:55 +01:00
BodilessSleeper
8e6920a18d
LibJS: Convert calendar operation results to floats
...
This commit ticks away one of the boxes in #15525
Temporal commit: tc39/proposal-temporal@11aad40
2023-01-05 19:49:09 +01:00
BodilessSleeper
1f1b2f4d26
LibJS: Rename ToPositiveInteger -> ToPositiveIntegerWithTruncation
...
This commit ticks away one of the boxes in #15525
Temporal commit: tc39/proposal-temporal@768b916
2023-01-03 17:53:51 +01:00
BodilessSleeper
4e6beaabcb
LibJS: Update comments in Temporal/Calendar.cpp
...
This commit ticks away one of the boxes in #15525
Temporal commit: tc39/proposal-temporal@08cc0fb
2023-01-03 17:53:51 +01:00
BodilessSleeper
84db0c8dbf
LibJS: Remove call to ToPositiveInteger after CalendarDaysInMonth
...
Implements: tc39/proposal-temporal@261692a
In order to remove the call to to_positive_integer() there neeeded
to be a change of return type from ThrowCompletionOr<Value> to
ThrowCompletionOr<double>.
This is one of the changes that will come anyways with the following
commit: tc39/proposal-temporal@11aad40 . :^)
2022-12-31 00:05:20 +01:00
Luke Wilde
fa1416987a
LibJS: Add yearOfWeek calendar methods and properties
...
This is a normative change in the Temporal spec.
See:
- 7fa4d18
- caa941d
2022-12-26 09:30:36 +01:00
Linus Groh
1c24b82dd7
LibJS: Convert ordinary_create_from_constructor() to NonnullGCPtr
2022-12-15 06:56:37 -05: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
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
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
Linus Groh
b0e7d59b8b
LibJS: Throw on conversion from TimeZone to Calendar and vice versa
...
This is a normative change in the Temporal spec.
See: 2084e77
2022-12-02 02:04:13 +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
Luke Wilde
4a167cfbec
LibJS: Add calendarName: "critical" option to toString() methods
...
This is a normative change in the Temporal spec.
See: e715a50
2022-11-03 19:15:50 +00:00
Yedaya Katsman
dcad8494d6
LibJS: Accept calendar names case-insensitively
...
This is a normative change in the Temporal spec
See tc39/proposal-temporal@03101c6
2022-10-24 23:00:19 +01:00
Moustafa Raafat
8f964604f0
LibJS: Refactor CalendarFields for better linearity
...
This is a normative change in the Temporal spec.
See: 9b139a1
2022-10-20 00:53:44 +02:00
Moustafa Raafat
092b33c96e
LibJS: Remove trivial operations ISO{Year,Month,Day}
...
This is an editorial change in the Temporal spec.
See: 606d8a2
2022-10-19 22:39:33 +02:00
Moustafa Raafat
48cc557dfa
LibJS: Merge ISOMonthCode and BuildISOMonthCode
...
This is an editorial change in the Temporal spec.
See: a4d17b1
2022-10-19 22:39:33 +02:00
Moustafa Raafat
b69ceae10c
LibJS: Improve alias names in ResolveISOMonth
...
This is an editorial change in the Temporal spec.
See: 01d5fbe
2022-10-19 22:39:33 +02:00
Moustafa Raafat
d758566996
LibJS: Simplify ResolveISOMonth
...
This is an editorial change in the Temporal spec.
See: 1b83226
2022-10-19 22:39:33 +02:00
Linus Groh
3d4ce3cc6d
LibJS: Add missing validation to remaining Calendar operations
...
This is a normative change in the Temporal spec.
See: c2a0cea
2022-10-17 12:56:05 +02:00
Linus Groh
b6f101f1c0
LibJS: Fix TemporalCalendarString ambiguity
...
This is a normative change in the Temporal spec.
See:
- 278d238
- b73aea7
2022-10-16 15:20:23 +02:00
Luke Wilde
8c3512d6ce
LibJS: Fast-path ToTemporalCalendar when the argument is a Calendar
...
This is a normative change in the Temporal spec.
See: 2a43b39
2022-10-16 13:40:21 +02:00
Luke Wilde
d5d1146cc3
LibJS/Temporal: Fix inconsistency in order of observable operations
...
This is a normative change in the Temporal spec.
See: a3a8237
2022-10-14 18:55:12 +02:00