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
commit dcdb0c7035
Notes: sideshowbarker 2024-07-18 12:31:08 +09:00
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);