mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +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
|
@ -146,7 +146,7 @@ ThrowCompletionOr<Value> get_option(VM& vm, Object const& options, PropertyKey c
|
|||
if (!values.is_empty()) {
|
||||
// NOTE: Every location in the spec that invokes GetOption with type=boolean also has values=undefined.
|
||||
VERIFY(value.is_string());
|
||||
if (auto const& value_string = TRY(value.as_string().deprecated_string()); !values.contains_slow(value_string))
|
||||
if (auto value_string = TRY(value.as_string().deprecated_string()); !values.contains_slow(value_string))
|
||||
return vm.throw_completion<RangeError>(ErrorType::OptionIsNotValidValue, value_string, property.as_string());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue