mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +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
|
@ -1305,8 +1305,12 @@ inline Value new_function(VM& vm, FunctionNode const& function_node, Optional<Id
|
|||
name = vm.bytecode_interpreter().current_executable().get_identifier(lhs_name.value());
|
||||
value = function_node.instantiate_ordinary_function_expression(vm, name);
|
||||
} else {
|
||||
value = ECMAScriptFunctionObject::create(*vm.current_realm(), function_node.name(), function_node.source_text(), function_node.body(), function_node.parameters(), function_node.function_length(), function_node.local_variables_names(), vm.lexical_environment(), vm.running_execution_context().private_environment, function_node.kind(), function_node.is_strict_mode(),
|
||||
function_node.parsing_insights(), function_node.is_arrow_function());
|
||||
value = ECMAScriptFunctionObject::create_from_function_node(
|
||||
function_node,
|
||||
function_node.name(),
|
||||
*vm.current_realm(),
|
||||
vm.lexical_environment(),
|
||||
vm.running_execution_context().private_environment);
|
||||
}
|
||||
|
||||
if (home_object.has_value()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue