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

LibJS: Implement bytecode generation for BigInts

This commit is contained in:
Gunnar Beutner 2021-06-08 07:59:25 +02:00 committed by Linus Groh
parent 0975e08285
commit 50ece3dd1b
5 changed files with 38 additions and 0 deletions

View file

@ -208,6 +208,13 @@ Optional<Bytecode::Register> NullLiteral::generate_bytecode(Bytecode::Generator&
return dst;
}
Optional<Bytecode::Register> BigIntLiteral::generate_bytecode(Bytecode::Generator& generator) const
{
auto dst = generator.allocate_register();
generator.emit<Bytecode::Op::NewBigInt>(dst, Crypto::SignedBigInteger::from_base10(m_value.substring(0, m_value.length() - 1)));
return dst;
}
Optional<Bytecode::Register> StringLiteral::generate_bytecode(Bytecode::Generator& generator) const
{
auto dst = generator.allocate_register();