mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:25:07 +00:00
LibJS: Use a 'Return' completion for generator object body evaluation
The comment a few lines above explains the issue, this one was forgotten and caused generator functions to return `undefined` when called.
This commit is contained in:
parent
3ec0183b51
commit
5a38f86f1b
1 changed files with 2 additions and 1 deletions
|
@ -777,7 +777,8 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
|||
if (m_kind != FunctionKind::Generator)
|
||||
return { Completion::Type::Return, result.value_or(js_undefined()), {} };
|
||||
|
||||
return normal_completion(TRY(GeneratorObject::create(global_object(), result, this, vm.running_execution_context().lexical_environment, bytecode_interpreter->snapshot_frame())));
|
||||
auto generator_object = TRY(GeneratorObject::create(global_object(), result, this, vm.running_execution_context().lexical_environment, bytecode_interpreter->snapshot_frame()));
|
||||
return { Completion::Type::Return, generator_object, {} };
|
||||
} else {
|
||||
if (m_kind == FunctionKind::Generator)
|
||||
return vm.throw_completion<InternalError>(global_object(), ErrorType::NotImplemented, "Generator function execution in AST interpreter");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue