1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 16:15:10 +00:00

LibJS/Bytecode: Make return; return undefined

Previously it would return whatever was in the accumulator.
This commit is contained in:
Luke Wilde 2022-06-11 23:13:02 +01:00 committed by Ali Mohammad Pur
parent 482a827346
commit 77f88d00e0

View file

@ -1363,6 +1363,8 @@ Bytecode::CodeGenerationErrorOr<void> ReturnStatement::generate_bytecode(Bytecod
{
if (m_argument)
TRY(m_argument->generate_bytecode(generator));
else
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
if (generator.is_in_generator_or_async_function()) {
generator.perform_needed_unwinds<Bytecode::Op::Yield>();