mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:07:36 +00:00
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.
This commit is contained in:
parent
9a120d7243
commit
a59ebdac2d
10 changed files with 22 additions and 21 deletions
|
@ -779,7 +779,7 @@ ThrowCompletionOr<double> resolve_iso_month(VM& vm, Object const& fields)
|
|||
|
||||
// 6. Assert: Type(monthCode) is String.
|
||||
VERIFY(month_code.is_string());
|
||||
auto const& month_code_string = TRY(month_code.as_string().deprecated_string());
|
||||
auto month_code_string = TRY(month_code.as_string().deprecated_string());
|
||||
|
||||
// 7. If the length of monthCode is not 3, throw a RangeError exception.
|
||||
auto month_length = month_code_string.length();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue