From 365df3464a4d0f4926cf904dd64357d7312f23ba Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 25 Jun 2023 11:11:36 +0200 Subject: [PATCH] LibJS/Bytecode: Transfer binding pattern aliases to function names 60 new passes on test262. :^) --- Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index eac272b03a6e35..3ae5528a20b0f5 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -1253,8 +1253,10 @@ static Bytecode::CodeGenerationErrorOr generate_array_binding_pattern_byte generator.switch_to_basic_block(value_is_undefined_block); - if (auto const* lhs = name.get_pointer>()) { - TRY(generator.emit_named_evaluation_if_anonymous_function(*initializer, (*lhs)->string())); + if (auto const* alias_identifier = alias.get_pointer>()) { + TRY(generator.emit_named_evaluation_if_anonymous_function(*initializer, (*alias_identifier)->string())); + } else if (auto const* name_identifier = name.get_pointer>()) { + TRY(generator.emit_named_evaluation_if_anonymous_function(*initializer, (*name_identifier)->string())); } else { TRY(initializer->generate_bytecode(generator)); }