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

LibJS: Add spec comments to Completion

This commit is contained in:
Linus Groh 2023-01-27 21:33:28 +00:00
parent e32265c896
commit 0f3899b24a
2 changed files with 8 additions and 5 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -28,6 +28,7 @@ Completion::Completion(ThrowCompletionOr<Value> const& throw_completion_or_value
}
// 6.2.3.1 Await, https://tc39.es/ecma262/#await
// FIXME: This no longer matches the spec!
ThrowCompletionOr<Value> await(VM& vm, Value value)
{
auto& realm = *vm.current_realm();
@ -120,9 +121,10 @@ ThrowCompletionOr<Value> await(VM& vm, Value value)
return throw_completion(result);
}
// 6.2.3.3 ThrowCompletion ( value ), https://tc39.es/ecma262/#sec-throwcompletion
// 6.2.4.2 ThrowCompletion ( value ), https://tc39.es/ecma262/#sec-throwcompletion
Completion throw_completion(Value value)
{
// 1. Return Completion Record { [[Type]]: throw, [[Value]]: value, [[Target]]: empty }.
return { Completion::Type::Throw, value, {} };
}