mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:07:34 +00:00
LibJS: Implement the NewDeclarativeEnvironment() abstract operation
This commit is contained in:
parent
c6baeca6d7
commit
d8e9a176cd
4 changed files with 16 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -8,6 +9,7 @@
|
|||
#include <AK/Result.h>
|
||||
#include <LibJS/Runtime/AbstractOperations.h>
|
||||
#include <LibJS/Runtime/BoundFunction.h>
|
||||
#include <LibJS/Runtime/DeclarativeEnvironmentRecord.h>
|
||||
#include <LibJS/Runtime/ErrorTypes.h>
|
||||
#include <LibJS/Runtime/Function.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
@ -156,4 +158,11 @@ Object* get_prototype_from_constructor(GlobalObject& global_object, Function con
|
|||
return &prototype.as_object();
|
||||
}
|
||||
|
||||
// 9.1.2.2 NewDeclarativeEnvironment ( E ), https://tc39.es/ecma262/#sec-newdeclarativeenvironment
|
||||
DeclarativeEnvironmentRecord* new_declarative_environment(EnvironmentRecord& environment_record)
|
||||
{
|
||||
auto& global_object = environment_record.global_object();
|
||||
return global_object.heap().allocate<DeclarativeEnvironmentRecord>(global_object, &environment_record);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue