Skip to content

Commit

Permalink
LibJS/Bytecode: Use LHS identifier as function name on logical assign
Browse files Browse the repository at this point in the history
9 new passes on test262. :^)
  • Loading branch information
awesomekling committed Jun 26, 2023
1 parent 17ba475 commit 54a1a52
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,11 @@ Bytecode::CodeGenerationErrorOr<void> AssignmentExpression::generate_bytecode(By
// if the logical assignment condition fails.
auto lhs_reg = generator.allocate_register();
generator.emit<Bytecode::Op::Store>(lhs_reg);
TRY(m_rhs->generate_bytecode(generator));

if (lhs->is_identifier())
TRY(generator.emit_named_evaluation_if_anonymous_function(*m_rhs, static_cast<Identifier const&>(*lhs).string()));
else
TRY(m_rhs->generate_bytecode(generator));

switch (m_op) {
case AssignmentOp::AdditionAssignment:
Expand Down

0 comments on commit 54a1a52

Please sign in to comment.