mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-19 01:22:54 +00:00
LibCodeComprehension: Re-organize code comprehension related code
This moves all code comprehension-related code to a new library, LibCodeComprehension. This also moves some types related to code comprehension tasks (such as autocomplete, find declaration) out of LibGUI and into LibCodeComprehension.
This commit is contained in:
parent
a2c34554cd
commit
b35293d945
Notes:
sideshowbarker
2024-07-17 10:45:06 +09:00
Author: https://github.com/itamar8910
Commit: b35293d945
Pull-request: https://github.com/SerenityOS/serenity/pull/14038
Reviewed-by: https://github.com/kleinesfilmroellchen
65 changed files with 685 additions and 491 deletions
|
@ -101,16 +101,16 @@ ClassViewModel::ClassViewModel()
|
|||
{
|
||||
m_root_scope.clear();
|
||||
ProjectDeclarations::the().for_each_declared_symbol([this](auto& decl) {
|
||||
if (decl.type == GUI::AutocompleteProvider::DeclarationType::Class
|
||||
|| decl.type == GUI::AutocompleteProvider::DeclarationType::Struct
|
||||
|| decl.type == GUI::AutocompleteProvider::DeclarationType::Member
|
||||
|| decl.type == GUI::AutocompleteProvider::DeclarationType::Namespace) {
|
||||
if (decl.type == CodeComprehension::DeclarationType::Class
|
||||
|| decl.type == CodeComprehension::DeclarationType::Struct
|
||||
|| decl.type == CodeComprehension::DeclarationType::Member
|
||||
|| decl.type == CodeComprehension::DeclarationType::Namespace) {
|
||||
add_declaration(decl);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static ClassViewNode& add_child_node(NonnullOwnPtrVector<ClassViewNode>& children, NonnullOwnPtr<ClassViewNode>&& node_ptr, ClassViewNode* parent, const GUI::AutocompleteProvider::Declaration* declaration)
|
||||
static ClassViewNode& add_child_node(NonnullOwnPtrVector<ClassViewNode>& children, NonnullOwnPtr<ClassViewNode>&& node_ptr, ClassViewNode* parent, CodeComprehension::Declaration const* declaration)
|
||||
{
|
||||
node_ptr->parent = parent;
|
||||
node_ptr->declaration = declaration;
|
||||
|
@ -127,7 +127,7 @@ static ClassViewNode& add_child_node(NonnullOwnPtrVector<ClassViewNode>& childre
|
|||
return children.at(inserted_index);
|
||||
}
|
||||
|
||||
void ClassViewModel::add_declaration(const GUI::AutocompleteProvider::Declaration& decl)
|
||||
void ClassViewModel::add_declaration(CodeComprehension::Declaration const& decl)
|
||||
{
|
||||
ClassViewNode* parent = nullptr;
|
||||
auto scope_parts = decl.scope.view().split_view("::");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue