mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 10:12:25 -05:00
LibJS: Add sequence expression bytecode generation
This commit is contained in:
parent
cac94b1c16
commit
1dc31842cb
Notes:
sideshowbarker
2024-07-18 12:39:19 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/1dc31842cb1 Pull-request: https://github.com/SerenityOS/serenity/pull/7906
2 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue