LibJS/Bytecode: Do not unwind eagerly after throwing Await
If an exception was thrown while evaluating the argument of an `await`
expression, we should jump to the continuation block instead of eagerly
rejecting the caller async function.
This restores the behavior prior to the addition of the separate `Await`
instruction in d66eb4e3
.
This commit is contained in:
parent
8fc545992d
commit
cff8f56ce7
Notes:
sideshowbarker
2024-07-16 22:16:50 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/cff8f56ce7 Pull-request: https://github.com/SerenityOS/serenity/pull/20026
1 changed files with 1 additions and 1 deletions
|
@ -278,7 +278,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Realm& realm, Execu
|
||||||
// but we generate a Yield Operation in the case of returns in
|
// but we generate a Yield Operation in the case of returns in
|
||||||
// generators as well, so we need to check if it will actually
|
// generators as well, so we need to check if it will actually
|
||||||
// continue or is a `return` in disguise
|
// continue or is a `return` in disguise
|
||||||
will_yield = instruction.type() == Instruction::Type::Yield && static_cast<Op::Yield const&>(instruction).continuation().has_value();
|
will_yield = (instruction.type() == Instruction::Type::Yield && static_cast<Op::Yield const&>(instruction).continuation().has_value()) || instruction.type() == Instruction::Type::Await;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++pc;
|
++pc;
|
||||||
|
|
Loading…
Add table
Reference in a new issue