mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:48:11 +00:00
LibCpp: Parse If statements
This commit is contained in:
parent
e8f040139b
commit
8ed65d7b48
4 changed files with 70 additions and 0 deletions
|
@ -379,4 +379,32 @@ NonnullRefPtrVector<Declaration> BlockStatement::declarations() const
|
|||
return declarations;
|
||||
}
|
||||
|
||||
void IfStatement::dump(size_t indent) const
|
||||
{
|
||||
ASTNode::dump(indent);
|
||||
if (m_predicate) {
|
||||
print_indent(indent + 1);
|
||||
dbgprintf("Predicate:\n");
|
||||
m_predicate->dump(indent + 1);
|
||||
}
|
||||
if (m_then) {
|
||||
print_indent(indent + 1);
|
||||
dbgprintf("Then:\n");
|
||||
m_then->dump(indent + 1);
|
||||
}
|
||||
if (m_else) {
|
||||
print_indent(indent + 1);
|
||||
dbgprintf("Else:\n");
|
||||
m_else->dump(indent + 1);
|
||||
}
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Declaration> IfStatement::declarations() const
|
||||
{
|
||||
NonnullRefPtrVector<Declaration> declarations;
|
||||
declarations.append(m_predicate->declarations());
|
||||
declarations.append(m_then->declarations());
|
||||
declarations.append(m_else->declarations());
|
||||
return declarations;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue