1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:08:11 +00:00

LibJS: Add bytecode support for regexp literals

This commit is contained in:
Matthew Olsson 2021-06-19 17:17:40 -07:00 committed by Andreas Kling
parent 3ccf4dc7ad
commit df65ff8a1e
5 changed files with 41 additions and 0 deletions

View file

@ -258,6 +258,13 @@ void StringLiteral::generate_bytecode(Bytecode::Generator& generator) const
generator.emit<Bytecode::Op::NewString>(generator.intern_string(m_value));
}
void RegExpLiteral::generate_bytecode(Bytecode::Generator& generator) const
{
auto source_index = generator.intern_string(m_pattern);
auto flags_index = generator.intern_string(m_flags);
generator.emit<Bytecode::Op::NewRegExp>(source_index, flags_index);
}
void Identifier::generate_bytecode(Bytecode::Generator& generator) const
{
if (m_argument_index.has_value())