diff --git a/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Libraries/LibJS/Bytecode/ASTCodegen.cpp index 1f1ef6717fd..ce12c6ceddf 100644 --- a/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -56,8 +56,10 @@ Bytecode::CodeGenerationErrorOr> ScopeNode::generate_byt Optional last_result; for (auto& child : children()) { auto result = TRY(child->generate_bytecode(generator)); - if (result.has_value()) - last_result = result; + if (generator.must_propagate_completion()) { + if (result.has_value()) + last_result = result; + } if (generator.is_current_block_terminated()) break; }