|
@@ -308,6 +308,11 @@ NonnullRefPtrVector<Declaration> ParserAutoComplete::get_global_declarations(con
|
|
if (decl.is_namespace()) {
|
|
if (decl.is_namespace()) {
|
|
declarations.append(get_global_declarations(decl));
|
|
declarations.append(get_global_declarations(decl));
|
|
}
|
|
}
|
|
|
|
+ if (decl.is_struct_or_class()) {
|
|
|
|
+ for (auto& member_decl : static_cast<StructOrClassDeclaration&>(decl).declarations()) {
|
|
|
|
+ declarations.append(member_decl);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
return declarations;
|
|
return declarations;
|
|
@@ -511,7 +516,6 @@ OwnPtr<ParserAutoComplete::DocumentData> ParserAutoComplete::create_document_dat
|
|
|
|
|
|
String ParserAutoComplete::scope_of_declaration(const Declaration& decl)
|
|
String ParserAutoComplete::scope_of_declaration(const Declaration& decl)
|
|
{
|
|
{
|
|
-
|
|
|
|
auto parent = decl.parent();
|
|
auto parent = decl.parent();
|
|
if (!parent)
|
|
if (!parent)
|
|
return {};
|
|
return {};
|
|
@@ -521,15 +525,17 @@ String ParserAutoComplete::scope_of_declaration(const Declaration& decl)
|
|
|
|
|
|
auto& parent_decl = static_cast<Declaration&>(*parent);
|
|
auto& parent_decl = static_cast<Declaration&>(*parent);
|
|
|
|
|
|
- if (parent_decl.is_namespace()) {
|
|
|
|
- auto& containing_namespace = static_cast<NamespaceDeclaration&>(parent_decl);
|
|
|
|
- auto scope_of_parent = scope_of_declaration(parent_decl);
|
|
|
|
- if (scope_of_parent.is_null())
|
|
|
|
- return containing_namespace.m_name;
|
|
|
|
- return String::formatted("{}::{}", scope_of_parent, containing_namespace.m_name);
|
|
|
|
- }
|
|
|
|
|
|
+ auto parent_scope = scope_of_declaration(parent_decl);
|
|
|
|
+ String containing_scope;
|
|
|
|
+ if (parent_decl.is_namespace())
|
|
|
|
+ containing_scope = static_cast<NamespaceDeclaration&>(parent_decl).m_name;
|
|
|
|
+ if (parent_decl.is_struct_or_class())
|
|
|
|
+ containing_scope = static_cast<StructOrClassDeclaration&>(parent_decl).name();
|
|
|
|
|
|
- return {};
|
|
|
|
|
|
+ if (parent_scope.is_null())
|
|
|
|
+ return containing_scope;
|
|
|
|
+
|
|
|
|
+ return String::formatted("{}::{}", parent_scope, containing_scope);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|