|
@@ -324,7 +324,7 @@ Value FunctionExpression::instantiate_ordinary_function_expression(VM& vm, Depre
|
|
|
|
|
|
auto private_environment = vm.running_execution_context().private_environment;
|
|
|
|
|
|
- auto closure = ECMAScriptFunctionObject::create(realm, used_name, source_text(), body(), parameters(), function_length(), environment, private_environment, kind(), is_strict_mode(), might_need_arguments_object(), contains_direct_call_to_eval(), is_arrow_function());
|
|
|
+ auto closure = ECMAScriptFunctionObject::create(realm, used_name, source_text(), body(), parameters(), function_length(), local_variables_names(), environment, private_environment, kind(), is_strict_mode(), might_need_arguments_object(), contains_direct_call_to_eval(), is_arrow_function());
|
|
|
|
|
|
// FIXME: 6. Perform SetFunctionName(closure, name).
|
|
|
// FIXME: 7. Perform MakeConstructor(closure).
|
|
@@ -1791,7 +1791,7 @@ ThrowCompletionOr<ClassElement::ClassValue> ClassField::class_element_evaluation
|
|
|
|
|
|
// FIXME: A potential optimization is not creating the functions here since these are never directly accessible.
|
|
|
auto function_code = create_ast_node<ClassFieldInitializerStatement>(m_initializer->source_range(), copy_initializer.release_nonnull(), name);
|
|
|
- initializer = make_handle(*ECMAScriptFunctionObject::create(realm, DeprecatedString::empty(), DeprecatedString::empty(), *function_code, {}, 0, vm.lexical_environment(), vm.running_execution_context().private_environment, FunctionKind::Normal, true, false, m_contains_direct_call_to_eval, false, property_key_or_private_name));
|
|
|
+ initializer = make_handle(*ECMAScriptFunctionObject::create(realm, DeprecatedString::empty(), DeprecatedString::empty(), *function_code, {}, 0, {}, vm.lexical_environment(), vm.running_execution_context().private_environment, FunctionKind::Normal, true, false, m_contains_direct_call_to_eval, false, property_key_or_private_name));
|
|
|
initializer->make_method(target);
|
|
|
}
|
|
|
|
|
@@ -1835,7 +1835,7 @@ ThrowCompletionOr<ClassElement::ClassValue> StaticInitializer::class_element_eva
|
|
|
// 4. Let formalParameters be an instance of the production FormalParameters : [empty] .
|
|
|
// 5. Let bodyFunction be OrdinaryFunctionCreate(%Function.prototype%, sourceText, formalParameters, ClassStaticBlockBody, non-lexical-this, lex, privateEnv).
|
|
|
// Note: The function bodyFunction is never directly accessible to ECMAScript code.
|
|
|
- auto body_function = ECMAScriptFunctionObject::create(realm, DeprecatedString::empty(), DeprecatedString::empty(), *m_function_body, {}, 0, lexical_environment, private_environment, FunctionKind::Normal, true, false, m_contains_direct_call_to_eval, false);
|
|
|
+ auto body_function = ECMAScriptFunctionObject::create(realm, DeprecatedString::empty(), DeprecatedString::empty(), *m_function_body, {}, 0, m_function_body->local_variables_names(), lexical_environment, private_environment, FunctionKind::Normal, true, false, m_contains_direct_call_to_eval, false);
|
|
|
|
|
|
// 6. Perform MakeMethod(bodyFunction, homeObject).
|
|
|
body_function->make_method(home_object);
|
|
@@ -1971,6 +1971,7 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::create_class_const
|
|
|
constructor.body(),
|
|
|
constructor.parameters(),
|
|
|
constructor.function_length(),
|
|
|
+ constructor.local_variables_names(),
|
|
|
vm.lexical_environment(),
|
|
|
vm.running_execution_context().private_environment,
|
|
|
constructor.kind(),
|
|
@@ -4754,7 +4755,7 @@ void ScopeNode::block_declaration_instantiation(VM& vm, Environment* environment
|
|
|
|
|
|
if (is<FunctionDeclaration>(declaration)) {
|
|
|
auto& function_declaration = static_cast<FunctionDeclaration const&>(declaration);
|
|
|
- auto function = ECMAScriptFunctionObject::create(realm, function_declaration.name(), function_declaration.source_text(), function_declaration.body(), function_declaration.parameters(), function_declaration.function_length(), environment, private_environment, function_declaration.kind(), function_declaration.is_strict_mode(), function_declaration.might_need_arguments_object(), function_declaration.contains_direct_call_to_eval());
|
|
|
+ auto function = ECMAScriptFunctionObject::create(realm, function_declaration.name(), function_declaration.source_text(), function_declaration.body(), function_declaration.parameters(), function_declaration.function_length(), function_declaration.local_variables_names(), environment, private_environment, function_declaration.kind(), function_declaration.is_strict_mode(), function_declaration.might_need_arguments_object(), function_declaration.contains_direct_call_to_eval());
|
|
|
VERIFY(is<DeclarativeEnvironment>(*environment));
|
|
|
static_cast<DeclarativeEnvironment&>(*environment).initialize_or_set_mutable_binding({}, vm, function_declaration.name(), function);
|
|
|
}
|
|
@@ -4948,7 +4949,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(VM& vm, Global
|
|
|
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 env and privateEnv.
|
|
|
- auto function = ECMAScriptFunctionObject::create(realm, declaration.name(), declaration.source_text(), declaration.body(), declaration.parameters(), declaration.function_length(), &global_environment, private_environment, declaration.kind(), declaration.is_strict_mode(), declaration.might_need_arguments_object(), declaration.contains_direct_call_to_eval());
|
|
|
+ auto function = ECMAScriptFunctionObject::create(realm, declaration.name(), declaration.source_text(), declaration.body(), declaration.parameters(), declaration.function_length(), declaration.local_variables_names(), &global_environment, private_environment, declaration.kind(), declaration.is_strict_mode(), declaration.might_need_arguments_object(), declaration.contains_direct_call_to_eval());
|
|
|
|
|
|
// c. Perform ? env.CreateGlobalFunctionBinding(fn, fo, false).
|
|
|
TRY(global_environment.create_global_function_binding(declaration.name(), function, false));
|