mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +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:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||
* Copyright (c) 2020-2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2020-2023, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
@@ -183,7 +183,7 @@ ThrowCompletionOr<Value> ECMAScriptFunctionObject::internal_call(Value this_argu
|
||||
|
||||
// 8. If result.[[Type]] is return, return result.[[Value]].
|
||||
if (result.type() == Completion::Type::Return)
|
||||
return result.value();
|
||||
return *result.value();
|
||||
|
||||
// 9. ReturnIfAbrupt(result).
|
||||
if (result.is_abrupt()) {
|
||||
|
||||
Reference in New Issue
Block a user