mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibJS: Align codegen AwaitExpressions to YieldExpressions
We use generators in bytecode to approximate async functions, but the code generated by AwaitExpressions did not have the value processing paths that Yield requires, eg the `generator.throw()` path, which is used by AsyncFunctionDriverWrapper to signal Promise rejections.
This commit is contained in:
parent
1f6a0ef6e0
commit
de514f29ad
Notes:
sideshowbarker
2024-07-16 23:42:40 +09:00
Author: https://github.com/Hendiadyoin1
Commit: de514f29ad
Pull-request: https://github.com/SerenityOS/serenity/pull/16184
Issue: https://github.com/SerenityOS/serenity/issues/16393
Reviewed-by: https://github.com/alimpfard ✅
Reviewed-by: https://github.com/kleinesfilmroellchen
4 changed files with 47 additions and 3 deletions
|
@ -169,7 +169,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
|||
if (!m_return_value.is_empty()) {
|
||||
return_value = m_return_value;
|
||||
m_return_value = {};
|
||||
} else if (!m_saved_return_value.is_null()) {
|
||||
} else if (!m_saved_return_value.is_null() && m_saved_exception.is_null()) {
|
||||
return_value = m_saved_return_value.value();
|
||||
m_saved_return_value = {};
|
||||
}
|
||||
|
@ -192,6 +192,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
|
|||
if (!m_saved_exception.is_null()) {
|
||||
Value thrown_value = m_saved_exception.value();
|
||||
m_saved_exception = {};
|
||||
m_saved_return_value = {};
|
||||
if (auto* register_window = frame.get_pointer<NonnullOwnPtr<RegisterWindow>>())
|
||||
return { throw_completion(thrown_value), move(*register_window) };
|
||||
return { throw_completion(thrown_value), nullptr };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue