1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibJS: Add ObjectEnvironmentRecord.[[IsWithEnvironment]] field

This is true for environments created by `with` statements, and false
for other (global) object environments.

Also add the WithBaseObject abstract operation while we're here.
This commit is contained in:
Andreas Kling 2021-06-24 13:24:44 +02:00
parent 3f8857cd21
commit 0cd65b55bd
5 changed files with 22 additions and 7 deletions

View file

@ -175,10 +175,7 @@ DeclarativeEnvironmentRecord* new_declarative_environment(EnvironmentRecord& env
ObjectEnvironmentRecord* new_object_environment(Object& object, bool is_with_environment, EnvironmentRecord* environment_record)
{
auto& global_object = object.global_object();
if (!is_with_environment) {
TODO();
}
return global_object.heap().allocate<ObjectEnvironmentRecord>(global_object, object, environment_record);
return global_object.heap().allocate<ObjectEnvironmentRecord>(global_object, object, is_with_environment ? ObjectEnvironmentRecord::IsWithEnvironment::Yes : ObjectEnvironmentRecord::IsWithEnvironment::No, environment_record);
}
// 9.4.3 GetThisEnvironment ( ), https://tc39.es/ecma262/#sec-getthisenvironment