1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:47:36 +00:00

LibJS: Make Bytecode::Generator::emit() return the created instruction

This will be useful for instructions that need to be modified later on
during code generation, e.g jumps. :^)
This commit is contained in:
Andreas Kling 2021-06-04 11:38:17 +02:00
parent 0553e0b048
commit 4934d16397

View file

@ -18,10 +18,12 @@ public:
Register allocate_register();
template<typename OpType, typename... Args>
void emit(Args&&... args)
OpType& emit(Args&&... args)
{
auto instruction = make<OpType>(forward<Args>(args)...);
auto* ptr = instruction.ptr();
append(move(instruction));
return *ptr;
}
private: