mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 11:20:03 +00:00
JSSpecCompiler: Add if branch merging pass
It merges standalone IfBranch/ElseIfBranch nodes into IfElseIfChain nodes. This will ease CFG generation later.
This commit is contained in:
committed by
Andrew Kaster
parent
092ed1cc8a
commit
4c4e1e1aed
@@ -71,6 +71,18 @@ Vector<NodeSubtreePointer> ElseIfBranch::subtrees()
|
||||
return { { &m_branch } };
|
||||
}
|
||||
|
||||
Vector<NodeSubtreePointer> IfElseIfChain::subtrees()
|
||||
{
|
||||
Vector<NodeSubtreePointer> result;
|
||||
for (size_t i = 0; i < branches_count(); ++i) {
|
||||
result.append({ &m_conditions[i] });
|
||||
result.append({ &m_branches[i] });
|
||||
}
|
||||
if (m_else_branch)
|
||||
result.append({ &m_else_branch });
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector<NodeSubtreePointer> TreeList::subtrees()
|
||||
{
|
||||
Vector<NodeSubtreePointer> result;
|
||||
|
||||
Reference in New Issue
Block a user