mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 07:41:01 +00:00
LibJS: Add ECMAScriptFunctionObject::create_from_function_node() helper
This gives us a shared entry point for every situation where we instantiate a function based on a FunctionNode from the AST.
This commit is contained in:
parent
ef4e7b7945
commit
4209b18b88
Notes:
github-actions[bot]
2025-04-08 16:54:03 +00:00
Author: https://github.com/awesomekling
Commit: 4209b18b88
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4283
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/trflynn89
7 changed files with 95 additions and 27 deletions
|
@ -972,8 +972,12 @@ ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, Program const& pr
|
|||
for (auto& declaration : functions_to_initialize.in_reverse()) {
|
||||
// a. Let fn be the sole element of the BoundNames of f.
|
||||
// b. Let fo be InstantiateFunctionObject of f with arguments lexEnv and privateEnv.
|
||||
auto function = ECMAScriptFunctionObject::create(realm, declaration.name(), declaration.source_text(), declaration.body(), declaration.parameters(), declaration.function_length(), declaration.local_variables_names(), lexical_environment, private_environment, declaration.kind(), declaration.is_strict_mode(),
|
||||
declaration.parsing_insights());
|
||||
auto function = ECMAScriptFunctionObject::create_from_function_node(
|
||||
declaration,
|
||||
declaration.name(),
|
||||
realm,
|
||||
lexical_environment,
|
||||
private_environment);
|
||||
|
||||
// c. If varEnv is a global Environment Record, then
|
||||
if (global_var_environment) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue