mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02: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:
committed by
Andreas Kling
parent
ef4e7b7945
commit
4209b18b88
Notes:
github-actions[bot]
2025-04-08 16:54:03 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/4209b18b88b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4283 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/trflynn89
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user