1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

JSSpecCompiler: Elide nested TreeList nodes

This commit is contained in:
Dan Klishch 2023-09-13 01:28:11 -04:00 committed by Jelle Raaijmakers
parent f30815b534
commit 14a86c8fd6
4 changed files with 23 additions and 12 deletions

View file

@ -59,7 +59,7 @@ public:
// For expressions, order must be the same as the evaluation order.
virtual Vector<NodeSubtreePointer> subtrees() { return {}; }
virtual bool is_type() { return false; }
virtual bool is_list() const { return false; }
protected:
template<typename... Parameters>
@ -372,14 +372,13 @@ protected:
class TreeList : public Statement {
public:
TreeList(Vector<Tree>&& expressions_)
: m_expressions(move(expressions_))
{
}
TreeList(Vector<Tree>&& trees);
Vector<NodeSubtreePointer> subtrees() override;
Vector<Tree> m_expressions;
bool is_list() const override { return true; }
Vector<Tree> m_trees;
protected:
void dump_tree(StringBuilder& builder) override;