1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 18:05:07 +00:00

LibJS: Use a Variant instead of two Optionals for ThrowCompletionOr

Comes with the usual benefit of saving some space on the stack, as well
as making a situation where both or neither Optionals hold a value
impossible.

The various unwrapping additions are required as we can no longer
construct a ThrowCompletionOr<T> from an Optional<T> - rightfully so.
This commit is contained in:
Linus Groh 2023-03-01 14:52:31 +00:00
parent e77503e49b
commit 8f1d13e73b
6 changed files with 26 additions and 27 deletions

View file

@ -186,7 +186,7 @@ JS::ThrowCompletionOr<JS::Value> cross_origin_get(JS::VM& vm, JS::Object const&
// 3. If IsDataDescriptor(desc) is true, then return desc.[[Value]].
if (descriptor->is_data_descriptor())
return descriptor->value;
return *descriptor->value;
// 4. Assert: IsAccessorDescriptor(desc) is true.
VERIFY(descriptor->is_accessor_descriptor());