1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:08:12 +00:00

LibJS: NewClass bytecode instruction

This adds a the NewClass bytecode instruction, enough of it
is implemented for it to show it in the bytecode (js -d).
This commit is contained in:
Johan Dahlin 2021-06-30 15:42:13 -03:00 committed by Andreas Kling
parent 3694b8b690
commit f6028c2534
6 changed files with 37 additions and 1 deletions

View file

@ -1300,4 +1300,10 @@ void SwitchStatement::generate_bytecode(Bytecode::Generator& generator) const
generator.switch_to_basic_block(end_block);
}
void ClassDeclaration::generate_bytecode(Bytecode::Generator& generator) const
{
generator.emit<Bytecode::Op::NewClass>(m_class_expression);
generator.emit<Bytecode::Op::SetVariable>(generator.intern_string(m_class_expression.ptr()->name()));
}
}