mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 01:29:17 +00:00
LibJS: Decouple new_function_environment() from FunctionObject
Now that only ECMAScriptFunctionObject uses this, we can remove the FunctionObject::new_function_environment() pure virtual method and just implement it as a standalone AO with an ECMAScriptFunctionObject parameter, next to the other NewFooEnvironment AOs.
This commit is contained in:
parent
53af66d57d
commit
fe5c2b7bb9
Notes:
sideshowbarker
2024-07-18 02:53:07 +09:00
Author: https://github.com/linusg
Commit: fe5c2b7bb9
Pull-request: https://github.com/SerenityOS/serenity/pull/10402
Reviewed-by: https://github.com/awesomekling ✅
11 changed files with 30 additions and 43 deletions
|
@ -195,19 +195,6 @@ Value NativeFunction::construct(FunctionObject&)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
FunctionEnvironment* NativeFunction::new_function_environment(Object* new_target)
|
||||
{
|
||||
// Simplified version of 9.1.2.4 NewFunctionEnvironment ( F, newTarget )
|
||||
Environment* parent_scope = nullptr;
|
||||
if (!vm().execution_context_stack().is_empty())
|
||||
parent_scope = vm().lexical_environment();
|
||||
|
||||
auto* environment = heap().allocate<FunctionEnvironment>(global_object(), parent_scope);
|
||||
environment->set_new_target(new_target ? new_target : js_undefined());
|
||||
|
||||
return environment;
|
||||
}
|
||||
|
||||
bool NativeFunction::is_strict_mode() const
|
||||
{
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue