1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 08:47:35 +00:00

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

View file

@ -2899,7 +2899,7 @@ Bytecode::CodeGenerationErrorOr<void> ExportStatement::generate_bytecode(Bytecod
} }
if (is<ClassExpression>(*m_statement)) { 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()) 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); generator.emit<Bytecode::Op::SetVariable>(generator.intern_identifier(ExportStatement::local_name_for_default), Bytecode::Op::SetVariable::InitializationMode::Initialize);