From 24d772af7c41bd9e5b0dc7f317591c43af632516 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Mon, 11 Apr 2022 21:32:37 +0100 Subject: [PATCH] LibJS: Move additional notes to spec comments onto their own line Having all spec comments verbatim on their own line with no additions made by us will make it easier to automate comparing said comments to their current spec counterparts. --- Userland/Libraries/LibJS/AST.cpp | 3 ++- Userland/Libraries/LibJS/Interpreter.cpp | 3 ++- Userland/Libraries/LibJS/Interpreter.h | 6 ++++-- .../Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp | 3 ++- .../LibJS/Runtime/FinalizationRegistryConstructor.cpp | 6 ++++-- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 6675f25951..b390528e2e 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -473,7 +473,8 @@ Completion SuperCall::execute(Interpreter& interpreter, GlobalObject& global_obj TRY(this_er.bind_this_value(global_object, result)); // 9. Let F be thisER.[[FunctionObject]]. - // 10. Assert: F is an ECMAScript function object. (NOTE: This is implied by the strong C++ type.) + // 10. Assert: F is an ECMAScript function object. + // NOTE: This is implied by the strong C++ type. [[maybe_unused]] auto& f = this_er.function_object(); // 11. Perform ? InitializeInstanceElements(result, F). diff --git a/Userland/Libraries/LibJS/Interpreter.cpp b/Userland/Libraries/LibJS/Interpreter.cpp index 6d997698ba..19ffcca15e 100644 --- a/Userland/Libraries/LibJS/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Interpreter.cpp @@ -52,7 +52,8 @@ ThrowCompletionOr Interpreter::run(Script& script_record) // 2. Let scriptContext be a new ECMAScript code execution context. ExecutionContext script_context(vm.heap()); - // 3. Set the Function of scriptContext to null. (This was done in the construction of script_context) + // 3. Set the Function of scriptContext to null. + // NOTE: This was done during execution context construction. // 4. Set the Realm of scriptContext to scriptRecord.[[Realm]]. script_context.realm = &script_record.realm(); diff --git a/Userland/Libraries/LibJS/Interpreter.h b/Userland/Libraries/LibJS/Interpreter.h index ce3e8dfefd..f66e302164 100644 --- a/Userland/Libraries/LibJS/Interpreter.h +++ b/Userland/Libraries/LibJS/Interpreter.h @@ -50,12 +50,14 @@ public: // 2. Let newContext be a new execution context. auto& new_context = interpreter->m_global_execution_context; - // 3. Set the Function of newContext to null. (This is done for us when the execution context is constructed) + // 3. Set the Function of newContext to null. + // NOTE: This was done during execution context construction. // 4. Set the Realm of newContext to realm. new_context.realm = realm; - // 5. Set the ScriptOrModule of newContext to null. (This was done during execution context construction) + // 5. Set the ScriptOrModule of newContext to null. + // NOTE: This was done during execution context construction. // 6. Push newContext onto the execution context stack; newContext is now the running execution context. vm.push_execution_context(new_context); diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index e030961315..2a35a0750c 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -627,7 +627,8 @@ ThrowCompletionOr ECMAScriptFunctionObject::prepare_for_ordinary_call(Exec TRY(vm.push_execution_context(callee_context, global_object())); // 13. NOTE: Any exception objects produced after this point are associated with calleeRealm. - // 14. Return calleeContext. (See NOTE above about how contexts are allocated on the C++ stack.) + // 14. Return calleeContext. + // NOTE: See the comment after step 2 above about how contexts are allocated on the C++ stack. return {}; } diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp index 838056223a..b438282cf9 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp @@ -50,10 +50,12 @@ ThrowCompletionOr FinalizationRegistryConstructor::construct(FunctionOb return vm.throw_completion(global_object, ErrorType::NotAFunction, cleanup_callback.to_string_without_side_effects()); // 3. Let finalizationRegistry be ? OrdinaryCreateFromConstructor(NewTarget, "%FinalizationRegistry.prototype%", « [[Realm]], [[CleanupCallback]], [[Cells]] »). - // 4. Let fn be the active function object. (NOTE: Not necessary. The active function object is `this`) + // 4. Let fn be the active function object. + // NOTE: This is not necessary, the active function object is `this`. // 5. Set finalizationRegistry.[[Realm]] to fn.[[Realm]]. // 6. Set finalizationRegistry.[[CleanupCallback]] to HostMakeJobCallback(cleanupCallback). - // 7. Set finalizationRegistry.[[Cells]] to a new empty List. (NOTE: This is done inside FinalizationRegistry instead of here) + // 7. Set finalizationRegistry.[[Cells]] to a new empty List. + // NOTE: This is done inside FinalizationRegistry instead of here. // 8. Return finalizationRegistry. return TRY(ordinary_create_from_constructor(global_object, new_target, &GlobalObject::finalization_registry_prototype, *realm(), vm.host_make_job_callback(cleanup_callback.as_function()))); }