Przeglądaj źródła

LibJS: Add spec comments to new_object_environment()

Linus Groh 2 lat temu
rodzic
commit
c6638f53c0

+ 6 - 0
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)
 ObjectEnvironment* new_object_environment(Object& object, bool is_with_environment, Environment* environment)
 {
 {
     auto& heap = object.heap();
     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<ObjectEnvironment>(object, is_with_environment ? ObjectEnvironment::IsWithEnvironment::Yes : ObjectEnvironment::IsWithEnvironment::No, environment);
     return heap.allocate_without_realm<ObjectEnvironment>(object, is_with_environment ? ObjectEnvironment::IsWithEnvironment::Yes : ObjectEnvironment::IsWithEnvironment::No, environment);
 }
 }