mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-27 12:46:06 +00:00
LibJS: Delete named_evaluation_if_anonymous_function()
This code was a leftover from AST interpreter.
This commit is contained in:
parent
6ad6e09be1
commit
0c8e76cbd7
Notes:
sideshowbarker
2024-07-17 10:05:47 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 0c8e76cbd7
Pull-request: https://github.com/SerenityOS/serenity/pull/24286
4 changed files with 0 additions and 42 deletions
|
@ -452,26 +452,6 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::create_class_const
|
|||
return { class_constructor };
|
||||
}
|
||||
|
||||
ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::class_definition_evaluation(VM& vm, Optional<DeprecatedFlyString> const& binding_name, DeprecatedFlyString const& class_name) const
|
||||
{
|
||||
auto* environment = vm.lexical_environment();
|
||||
VERIFY(environment);
|
||||
auto class_environment = new_declarative_environment(*environment);
|
||||
|
||||
Value super_class;
|
||||
|
||||
if (binding_name.has_value())
|
||||
MUST(class_environment->create_immutable_binding(vm, binding_name.value(), true));
|
||||
|
||||
if (!m_super_class.is_null()) {
|
||||
vm.running_execution_context().lexical_environment = class_environment;
|
||||
super_class = TRY(vm.execute_ast_node(*m_super_class));
|
||||
vm.running_execution_context().lexical_environment = environment;
|
||||
}
|
||||
|
||||
return create_class_constructor(vm, class_environment, environment, super_class, binding_name, class_name);
|
||||
}
|
||||
|
||||
void ASTNode::dump(int indent) const
|
||||
{
|
||||
print_indent(indent);
|
||||
|
|
|
@ -1446,7 +1446,6 @@ public:
|
|||
|
||||
bool has_name() const { return m_name; }
|
||||
|
||||
ThrowCompletionOr<ECMAScriptFunctionObject*> class_definition_evaluation(VM&, Optional<DeprecatedFlyString> const& binding_name = {}, DeprecatedFlyString const& class_name = {}) const;
|
||||
ThrowCompletionOr<ECMAScriptFunctionObject*> create_class_constructor(VM&, Environment* class_environment, Environment* environment, Value super_class, Optional<DeprecatedFlyString> const& binding_name = {}, DeprecatedFlyString const& class_name = {}) const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -219,25 +219,6 @@ void VM::gather_roots(HashMap<Cell*, HeapRoot>& roots)
|
|||
roots.set(job, HeapRoot { .type = HeapRoot::Type::VM });
|
||||
}
|
||||
|
||||
ThrowCompletionOr<Value> VM::named_evaluation_if_anonymous_function(ASTNode const& expression, DeprecatedFlyString const& name)
|
||||
{
|
||||
// 8.3.3 Static Semantics: IsAnonymousFunctionDefinition ( expr ), https://tc39.es/ecma262/#sec-isanonymousfunctiondefinition
|
||||
// And 8.3.5 Runtime Semantics: NamedEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-namedevaluation
|
||||
if (is<FunctionExpression>(expression)) {
|
||||
auto& function = static_cast<FunctionExpression const&>(expression);
|
||||
if (!function.has_name()) {
|
||||
return function.instantiate_ordinary_function_expression(*this, name);
|
||||
}
|
||||
} else if (is<ClassExpression>(expression)) {
|
||||
auto& class_expression = static_cast<ClassExpression const&>(expression);
|
||||
if (!class_expression.has_name()) {
|
||||
return TRY(class_expression.class_definition_evaluation(*this, {}, name));
|
||||
}
|
||||
}
|
||||
|
||||
return execute_ast_node(expression);
|
||||
}
|
||||
|
||||
ThrowCompletionOr<Value> VM::execute_ast_node(ASTNode const& node)
|
||||
{
|
||||
// FIXME: This function should be gone once we will emit bytecode for everything before executing instructions.
|
||||
|
|
|
@ -226,8 +226,6 @@ public:
|
|||
|
||||
CustomData* custom_data() { return m_custom_data; }
|
||||
|
||||
ThrowCompletionOr<Value> named_evaluation_if_anonymous_function(ASTNode const& expression, DeprecatedFlyString const& name);
|
||||
|
||||
void save_execution_context_stack();
|
||||
void clear_execution_context_stack();
|
||||
void restore_execution_context_stack();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue