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

LibCpp: Support non-field class members

Previously, we had a special ASTNode for class members,
"MemberDeclaration", which only represented fields.

This commit removes MemberDeclaration and instead uses regular
Declaration nodes for representing the members of a class.

This means that we can now also parse methods, inner-classes, and other
declarations that appear inside of a class.
This commit is contained in:
Itamar 2021-06-05 17:57:13 +03:00 committed by Andreas Kling
parent 8f074222e8
commit dcdb0c7035
6 changed files with 71 additions and 77 deletions

View file

@ -308,17 +308,6 @@ NonnullRefPtrVector<Declaration> StructOrClassDeclaration::declarations() const
return declarations;
}
void MemberDeclaration::dump(FILE* output, size_t indent) const
{
ASTNode::dump(output, indent);
m_type->dump(output, indent + 1);
print_indent(output, indent + 1);
outln(output, "{}", m_name);
if (m_initial_value) {
m_initial_value->dump(output, indent + 2);
}
}
void UnaryExpression::dump(FILE* output, size_t indent) const
{
ASTNode::dump(output, indent);