mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-04 17:33:04 +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:
parent
e77503e49b
commit
8f1d13e73b
Notes:
sideshowbarker
2024-07-17 05:02:42 +09:00
Author: https://github.com/linusg
Commit: 8f1d13e73b
Pull-request: https://github.com/SerenityOS/serenity/pull/17682
6 changed files with 26 additions and 27 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue