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

LibCpp: Fix Declaration::is_member()

Previously, Declaration::is_member() was just a stub that always
returned false.

It now works by checking whether the parent ASTNode is a declaration
of a struct or a class type.
This commit is contained in:
Itamar 2022-02-05 18:07:58 +02:00 committed by Andreas Kling
parent 13aee1b780
commit 36aac14798

View file

@ -124,7 +124,7 @@ public:
virtual bool is_class() const { return false; }
virtual bool is_function() const { return false; }
virtual bool is_namespace() const { return false; }
virtual bool is_member() const { return false; }
bool is_member() const { return parent() != nullptr && parent()->is_declaration() && verify_cast<Declaration>(parent())->is_struct_or_class(); }
StringView name() const { return m_name; }
void set_name(StringView name) { m_name = move(name); }