Skip to content

Commit

Permalink
LibJS/Bytecode: Prefer alias over name in object pattern bindings
Browse files Browse the repository at this point in the history
10 new passes on test262. :^)
  • Loading branch information
awesomekling committed Jun 27, 2023
1 parent 1dc7f03 commit b2078a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,9 @@ static Bytecode::CodeGenerationErrorOr<void> generate_object_binding_pattern_byt
Bytecode::Label { if_not_undefined_block });

generator.switch_to_basic_block(if_undefined_block);
if (auto const* lhs = name.get_pointer<NonnullRefPtr<Identifier const>>()) {
if (auto const* alias_identifier = alias.get_pointer<NonnullRefPtr<Identifier const>>()) {
TRY(generator.emit_named_evaluation_if_anonymous_function(*initializer, (*alias_identifier)->string()));
} else if (auto const* lhs = name.get_pointer<NonnullRefPtr<Identifier const>>()) {
TRY(generator.emit_named_evaluation_if_anonymous_function(*initializer, (*lhs)->string()));
} else {
TRY(initializer->generate_bytecode(generator));
Expand Down

0 comments on commit b2078a5

Please sign in to comment.