summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-24 22:46:54 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-25 12:57:21 +0200
commit6fc3c14b7ab67d492819cb57fd88f45b6b4abf03 (patch)
treec20257f68057ee8e52a31614287d2072ab15ccde
parentac1cac286bc0a4031ab3d6aee1f60c0d91751866 (diff)
downloadserenity-6fc3c14b7ab67d492819cb57fd88f45b6b4abf03.zip
LibJS: Fix bogus bytecode codegen for "catch" parameters
Add a missing '!' so that catch clauses with a named parameter actually generate a SetVariable opcode.
-rw-r--r--Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp
index 679025af80..b55a79dddd 100644
--- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp
@@ -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));
}