mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 01:58:12 +00:00
LibJS/Bytecode: Make return;
return undefined
Previously it would return whatever was in the accumulator.
This commit is contained in:
parent
482a827346
commit
77f88d00e0
1 changed files with 2 additions and 0 deletions
|
@ -1363,6 +1363,8 @@ Bytecode::CodeGenerationErrorOr<void> ReturnStatement::generate_bytecode(Bytecod
|
||||||
{
|
{
|
||||||
if (m_argument)
|
if (m_argument)
|
||||||
TRY(m_argument->generate_bytecode(generator));
|
TRY(m_argument->generate_bytecode(generator));
|
||||||
|
else
|
||||||
|
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
|
||||||
|
|
||||||
if (generator.is_in_generator_or_async_function()) {
|
if (generator.is_in_generator_or_async_function()) {
|
||||||
generator.perform_needed_unwinds<Bytecode::Op::Yield>();
|
generator.perform_needed_unwinds<Bytecode::Op::Yield>();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue