summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Bytecode/Interpreter.h
diff options
context:
space:
mode:
authorHendiadyoin1 <leon.a@serenityos.org>2022-12-25 17:15:29 +0100
committerLinus Groh <mail@linusgroh.de>2023-02-26 19:40:09 +0100
commitde514f29ad2dc5afde628c09b2f34c3e37b83ffd (patch)
treeabffb19b4e38b3310d7b3da03d70cb73cc022d22 /Userland/Libraries/LibJS/Bytecode/Interpreter.h
parent1f6a0ef6e0dd26447275e9f19e84f0d5c0216c8e (diff)
downloadserenity-de514f29ad2dc5afde628c09b2f34c3e37b83ffd.zip
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.
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode/Interpreter.h')
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Interpreter.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.h b/Userland/Libraries/LibJS/Bytecode/Interpreter.h
index 63068c090d..45bd02308c 100644
--- a/Userland/Libraries/LibJS/Bytecode/Interpreter.h
+++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.h
@@ -65,7 +65,11 @@ public:
VERIFY(unwind_contexts().last().finalizer);
jump(Label { *unwind_contexts().last().finalizer });
}
- void do_return(Value return_value) { m_return_value = return_value; }
+ void do_return(Value return_value)
+ {
+ m_return_value = return_value;
+ m_saved_exception = {};
+ }
void enter_unwind_context(Optional<Label> handler_target, Optional<Label> finalizer_target);
void leave_unwind_context();