LibCpp: Add 'Namespace' and 'Member' declaration types

This commit is contained in:
Itamar 2021-04-10 17:34:57 +03:00 committed by Andreas Kling
parent c6c83bd80e
commit b87791cada
Notes: sideshowbarker 2024-07-18 20:26:03 +09:00
3 changed files with 8 additions and 0 deletions

View file

@ -486,6 +486,10 @@ GUI::AutocompleteProvider::DeclarationType ParserAutoComplete::type_of_declarati
return GUI::AutocompleteProvider::DeclarationType::Function;
if (decl.is_variable_declaration())
return GUI::AutocompleteProvider::DeclarationType::Variable;
if (decl.is_namespace())
return GUI::AutocompleteProvider::DeclarationType::Namespace;
if (decl.is_member())
return GUI::AutocompleteProvider::DeclarationType::Member;
return GUI::AutocompleteProvider::DeclarationType::Variable;
}

View file

@ -137,6 +137,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; }
const StringView& name() const { return m_name; }
StringView m_name;
@ -529,6 +530,7 @@ public:
virtual ~MemberDeclaration() override = default;
virtual const char* class_name() const override { return "MemberDeclaration"; }
virtual void dump(size_t indent) const override;
virtual bool is_member() const override { return true; }
MemberDeclaration(ASTNode* parent, Optional<Position> start, Optional<Position> end, const String& filename)
: Declaration(parent, start, end, filename)

View file

@ -69,6 +69,8 @@ public:
Class,
Variable,
PreprocessorDefinition,
Namespace,
Member,
};
struct Declaration {