summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCpp
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2022-02-05 18:07:58 +0200
committerAndreas Kling <kling@serenityos.org>2022-02-09 00:51:31 +0100
commit36aac1479890c1a10c2544fd2b74b581c550ff54 (patch)
treec788b3a326a8fee67961abf77369ea0ac17aaf15 /Userland/Libraries/LibCpp
parent13aee1b780ab9997352aedf0f3d90844bce658a8 (diff)
downloadserenity-36aac1479890c1a10c2544fd2b74b581c550ff54.zip
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.
Diffstat (limited to 'Userland/Libraries/LibCpp')
-rw-r--r--Userland/Libraries/LibCpp/AST.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibCpp/AST.h b/Userland/Libraries/LibCpp/AST.h
index 7bb7b25f35..8ee5a0ae04 100644
--- a/Userland/Libraries/LibCpp/AST.h
+++ b/Userland/Libraries/LibCpp/AST.h
@@ -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); }