LibJS/Bytecode: Propagate FDI errors normally for async generators
Previously it returned a rejected promise, which is not correct: https://tc39.es/ecma262/#sec-runtime-semantics-evaluateasyncgeneratorbody ``` 1. Perform ? FunctionDeclarationInstantiation(functionObject, argumentsList). ```
This commit is contained in:
parent
265a9b5ffc
commit
53e527281f
Notes:
sideshowbarker
2024-07-17 20:58:35 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/53e527281f Pull-request: https://github.com/SerenityOS/serenity/pull/19934 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/linusg ✅
1 changed files with 2 additions and 2 deletions
|
@ -891,7 +891,7 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
|||
|
||||
auto declaration_result = function_declaration_instantiation(nullptr);
|
||||
|
||||
if (m_kind == FunctionKind::Normal || m_kind == FunctionKind::Generator) {
|
||||
if (m_kind == FunctionKind::Normal || m_kind == FunctionKind::Generator || m_kind == FunctionKind::AsyncGenerator) {
|
||||
if (declaration_result.is_error())
|
||||
return declaration_result.release_error();
|
||||
}
|
||||
|
@ -899,7 +899,7 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
|||
if (!m_bytecode_executable)
|
||||
m_bytecode_executable = TRY(Bytecode::compile(vm, *m_ecmascript_code, m_kind, m_name));
|
||||
|
||||
if (m_kind == FunctionKind::Async || m_kind == FunctionKind::AsyncGenerator) {
|
||||
if (m_kind == FunctionKind::Async) {
|
||||
if (declaration_result.is_throw_completion()) {
|
||||
auto promise_capability = MUST(new_promise_capability(vm, realm.intrinsics().promise_constructor()));
|
||||
MUST(call(vm, *promise_capability->reject(), js_undefined(), *declaration_result.throw_completion().value()));
|
||||
|
|
Loading…
Add table
Reference in a new issue