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

LibJS: Fix bogus bytecode codegen for "catch" parameters

Add a missing '!' so that catch clauses with a named parameter actually
generate a SetVariable opcode.
This commit is contained in:
Andreas Kling 2021-10-24 22:46:54 +02:00
parent ac1cac286b
commit 6fc3c14b7a

View file

@ -1200,7 +1200,7 @@ void TryStatement::generate_bytecode(Bytecode::Generator& generator) const
generator.emit<Bytecode::Op::LeaveUnwindContext>();
m_handler->parameter().visit(
[&](FlyString const& parameter) {
if (parameter.is_empty()) {
if (!parameter.is_empty()) {
// FIXME: We need a separate DeclarativeEnvironment here
generator.emit<Bytecode::Op::SetVariable>(generator.intern_identifier(parameter));
}