mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS/Bytecode: Use LHS identifier as function name on logical assign
This now creates a function named `x`: x ||= function() { } 9 new passes on test262. :^)
This commit is contained in:
parent
17ba47558c
commit
55531e5cda
Notes:
sideshowbarker
2024-07-17 11:33:34 +09:00
Author: https://github.com/awesomekling
Commit: 55531e5cda
Pull-request: https://github.com/SerenityOS/serenity/pull/19649
1 changed files with 5 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue