summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2023-01-27 21:33:28 +0000
committerLinus Groh <mail@linusgroh.de>2023-01-28 00:41:18 +0000
commit0f3899b24af5b61adab5a5b28931677cde7c8b3f (patch)
treeee53887faaa611cef72d2d81fd6ed52f39b51391 /Userland/Libraries
parente32265c896523f75098b1aa51d91508f21e03866 (diff)
downloadserenity-0f3899b24af5b61adab5a5b28931677cde7c8b3f.zip
LibJS: Add spec comments to Completion
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Completion.cpp6
-rw-r--r--Userland/Libraries/LibJS/Runtime/Completion.h7
2 files changed, 8 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Completion.cpp b/Userland/Libraries/LibJS/Runtime/Completion.cpp
index f5f5b94df4..647e1291d8 100644
--- a/Userland/Libraries/LibJS/Runtime/Completion.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Completion.cpp
@@ -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, {} };
}
diff --git a/Userland/Libraries/LibJS/Runtime/Completion.h b/Userland/Libraries/LibJS/Runtime/Completion.h
index b052273e5f..96dbd62a3a 100644
--- a/Userland/Libraries/LibJS/Runtime/Completion.h
+++ b/Userland/Libraries/LibJS/Runtime/Completion.h
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@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
*/
@@ -345,13 +345,14 @@ public:
ThrowCompletionOr<Value> await(VM&, Value);
-// 6.2.3.2 NormalCompletion ( value ), https://tc39.es/ecma262/#sec-normalcompletion
+// 6.2.4.1 NormalCompletion ( value ), https://tc39.es/ecma262/#sec-normalcompletion
inline Completion normal_completion(Optional<Value> value)
{
+ // 1. Return Completion Record { [[Type]]: normal, [[Value]]: value, [[Target]]: empty }.
return { Completion::Type::Normal, move(value), {} };
}
-// 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);
}