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

LibJS: Make if yield undefined for the else branch if it is missing

This commit is contained in:
Gunnar Beutner 2021-06-08 11:30:57 +02:00 committed by Andreas Kling
parent d9989fd259
commit 0975e08285

View file

@ -397,6 +397,8 @@ Optional<Bytecode::Register> IfStatement::generate_bytecode(Bytecode::Generator&
if (m_alternate) {
auto alternative_reg = m_alternate->generate_bytecode(generator);
generator.emit<Bytecode::Op::LoadRegister>(result_reg, *alternative_reg);
} else {
generator.emit<Bytecode::Op::Load>(result_reg, js_undefined());
}
end_jump.set_target(generator.make_label());