From c6638f53c0335f49e1c903873d765c33bc16531e Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Mon, 12 Dec 2022 21:17:12 +0000 Subject: [PATCH] LibJS: Add spec comments to new_object_environment() --- Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index b65e38a1b9..739dbac45d 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -397,6 +397,12 @@ DeclarativeEnvironment* new_declarative_environment(Environment& environment) ObjectEnvironment* new_object_environment(Object& object, bool is_with_environment, Environment* environment) { auto& heap = object.heap(); + + // 1. Let env be a new Object Environment Record. + // 2. Set env.[[BindingObject]] to O. + // 3. Set env.[[IsWithEnvironment]] to W. + // 4. Set env.[[OuterEnv]] to E. + // 5. Return env. return heap.allocate_without_realm(object, is_with_environment ? ObjectEnvironment::IsWithEnvironment::Yes : ObjectEnvironment::IsWithEnvironment::No, environment); }