LibJS: Add sequence expression bytecode generation

This commit is contained in:
Luke 2021-06-08 10:13:37 +01:00 committed by Andreas Kling
parent cac94b1c16
commit 1dc31842cb
Notes: sideshowbarker 2024-07-18 12:39:19 +09:00
2 changed files with 11 additions and 0 deletions

View file

@ -604,6 +604,7 @@ public:
virtual void dump(int indent) const override;
virtual Value execute(Interpreter&, GlobalObject&) const override;
virtual Optional<Bytecode::Register> generate_bytecode(Bytecode::Generator&) const override;
private:
NonnullRefPtrVector<Expression> m_expressions;

View file

@ -449,4 +449,14 @@ Optional<Bytecode::Register> ConditionalExpression::generate_bytecode(Bytecode::
return result_reg;
}
Optional<Bytecode::Register> SequenceExpression::generate_bytecode(Bytecode::Generator& generator) const
{
Optional<Bytecode::Register> last_reg;
for (auto& expression : m_expressions)
last_reg = expression.generate_bytecode(generator);
return last_reg;
}
}