summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCpp
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-04-08 20:34:01 +0300
committerAndreas Kling <kling@serenityos.org>2021-04-13 15:16:27 +0200
commitc6c83bd80eb65a2cc4f9fc1fb0c5f15ae5c0d64c (patch)
tree4db2aa86978626bfb8ca3103f44ad48966adf608 /Userland/Libraries/LibCpp
parentc8ad1df1433aa27856dbbccc7c614e9df93b6b42 (diff)
downloadserenity-c6c83bd80eb65a2cc4f9fc1fb0c5f15ae5c0d64c.zip
HackStudio+LibCpp: Include class members in Locator
Diffstat (limited to 'Userland/Libraries/LibCpp')
-rw-r--r--Userland/Libraries/LibCpp/AST.cpp7
-rw-r--r--Userland/Libraries/LibCpp/AST.h4
2 files changed, 8 insertions, 3 deletions
diff --git a/Userland/Libraries/LibCpp/AST.cpp b/Userland/Libraries/LibCpp/AST.cpp
index 0b77c21828..0764cfe5bf 100644
--- a/Userland/Libraries/LibCpp/AST.cpp
+++ b/Userland/Libraries/LibCpp/AST.cpp
@@ -309,6 +309,13 @@ void StructOrClassDeclaration::dump(size_t indent) const
member.dump(indent + 1);
}
}
+NonnullRefPtrVector<Declaration> StructOrClassDeclaration::declarations() const
+{
+ NonnullRefPtrVector<Declaration> declarations;
+ for (auto& member : m_members)
+ declarations.append(member);
+ return declarations;
+}
void MemberDeclaration::dump(size_t indent) const
{
diff --git a/Userland/Libraries/LibCpp/AST.h b/Userland/Libraries/LibCpp/AST.h
index 5551751fd1..d2ada70b8a 100644
--- a/Userland/Libraries/LibCpp/AST.h
+++ b/Userland/Libraries/LibCpp/AST.h
@@ -521,7 +521,6 @@ public:
{
}
- StringView m_name;
Vector<StringView> m_entries;
};
@@ -537,7 +536,6 @@ public:
}
RefPtr<Type> m_type;
- StringView m_name;
RefPtr<Expression> m_initial_value;
};
@@ -549,6 +547,7 @@ public:
virtual bool is_struct_or_class() const override { return true; }
virtual bool is_struct() const override { return m_type == Type::Struct; }
virtual bool is_class() const override { return m_type == Type::Class; }
+ virtual NonnullRefPtrVector<Declaration> declarations() const override;
enum class Type {
Struct,
@@ -683,7 +682,6 @@ public:
virtual NonnullRefPtrVector<Declaration> declarations() const override { return m_declarations; }
- StringView m_name;
NonnullRefPtrVector<Declaration> m_declarations;
};