diff options
author | Luke Wilde <lukew@serenityos.org> | 2022-11-25 23:14:27 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-11-26 12:55:59 +0100 |
commit | b914680f0c94e4547c4aaea25bc34b364a726dcf (patch) | |
tree | 984fbdfd1acabfaed49bee65df639ee9d720c635 /Userland/Libraries/LibJS/Bytecode | |
parent | 0c8da1478a9ed86f5b61225b638ce1ce25913c88 (diff) | |
download | serenity-b914680f0c94e4547c4aaea25bc34b364a726dcf.zip |
LibJS/Bytecode: Make `yield` by itself yield undefined
Diffstat (limited to 'Userland/Libraries/LibJS/Bytecode')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index edfcd642fc..9c8534a08e 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -1600,6 +1600,8 @@ Bytecode::CodeGenerationErrorOr<void> YieldExpression::generate_bytecode(Bytecod if (m_argument) TRY(m_argument->generate_bytecode(generator)); + else + generator.emit<Bytecode::Op::LoadImmediate>(js_undefined()); auto& continuation_block = generator.make_block(); generator.emit<Bytecode::Op::Yield>(Bytecode::Label { continuation_block }); |