mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-23 03:22:54 +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:
parent
092ed1cc8a
commit
4c4e1e1aed
Notes:
sideshowbarker
2024-07-17 06:51:10 +09:00
Author: https://github.com/DanShaders
Commit: 4c4e1e1aed
Pull-request: https://github.com/SerenityOS/serenity/pull/20917
8 changed files with 184 additions and 0 deletions
|
@ -97,6 +97,18 @@ void ElseIfBranch::dump_tree(StringBuilder& builder)
|
|||
m_branch->format_tree(builder);
|
||||
}
|
||||
|
||||
void IfElseIfChain::dump_tree(StringBuilder& builder)
|
||||
{
|
||||
dump_node(builder, "IfElseIfChain");
|
||||
|
||||
for (size_t i = 0; i < branches_count(); ++i) {
|
||||
m_conditions[i]->format_tree(builder);
|
||||
m_branches[i]->format_tree(builder);
|
||||
}
|
||||
if (m_else_branch)
|
||||
m_else_branch->format_tree(builder);
|
||||
}
|
||||
|
||||
void TreeList::dump_tree(StringBuilder& builder)
|
||||
{
|
||||
dump_node(builder, "TreeList");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue