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:
parent
d9989fd259
commit
0975e08285
1 changed files with 2 additions and 0 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue