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:
parent
ffa380f15b
commit
fa78df7ab7
1 changed files with 4 additions and 0 deletions
|
|
@ -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(),
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue