LibJS/Bytecode: Infer name of anonymous exported classes when possible

5 new passes on test262. :^)
This commit is contained in:
Andreas Kling 2023-07-02 11:56:55 +02:00
parent b0ae1e80fb
commit cea2071349
Notes: sideshowbarker 2024-07-17 01:55:29 +09:00

View file

@ -2899,7 +2899,7 @@ Bytecode::CodeGenerationErrorOr<void> ExportStatement::generate_bytecode(Bytecod
}
if (is<ClassExpression>(*m_statement)) {
TRY(m_statement->generate_bytecode(generator));
TRY(generator.emit_named_evaluation_if_anonymous_function(static_cast<ClassExpression const&>(*m_statement), generator.intern_identifier("default"sv)));
if (!static_cast<ClassExpression const&>(*m_statement).has_name())
generator.emit<Bytecode::Op::SetVariable>(generator.intern_identifier(ExportStatement::local_name_for_default), Bytecode::Op::SetVariable::InitializationMode::Initialize);