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:
parent
3ccf4dc7ad
commit
df65ff8a1e
5 changed files with 41 additions and 0 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue