LibJS/Rust: Call perform_needed_unwinds before Throw instructions

Add missing perform_needed_unwinds() calls before Throw instructions
in four places:
- Await continuation throw path
- Yield* throw_value_block
- Yield* iterator missing throw method
- Invalid left-hand side in assignment helper

This matches the C++ pipeline which calls perform_needed_unwinds<Throw>
before every Throw to restore lexical environments when throwing out of
scopes like with statements.
This commit is contained in:
Andreas Kling
2026-03-01 14:19:10 +01:00
committed by Andreas Kling
parent ffa380f15b
commit fa78df7ab7
Notes: github-actions[bot] 2026-03-01 20:23:00 +00:00

View File

@@ -824,6 +824,7 @@ fn generate_yield_expression(
generator.emit_jump_if(&type_is_throw, throw_value_block, return_value_block);
generator.switch_to_basic_block(throw_value_block);
generator.perform_needed_unwinds();
generator.emit(Instruction::Throw {
src: received_completion_value.operand(),
});
@@ -1256,6 +1257,7 @@ fn generate_await_with_completions(
generator.emit_jump_if(&is_normal, normal_block, throw_block);
generator.switch_to_basic_block(throw_block);
generator.perform_needed_unwinds();
generator.emit(Instruction::Throw {
src: received_completion_value.operand(),
});
@@ -1580,6 +1582,7 @@ fn generate_yield_from(
dst: exception.operand(),
error_string,
});
generator.perform_needed_unwinds();
generator.emit(Instruction::Throw {
src: exception.operand(),
});
@@ -4041,6 +4044,7 @@ fn emit_invalid_lhs_error(generator: &mut Generator) {
dst: exception.operand(),
error_string,
});
generator.perform_needed_unwinds();
generator.emit(Instruction::Throw {
src: exception.operand(),
});