1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

LibCpp: Add TemplatizedName

This type represents templatized names, and replaces our previous use
of 'TemplatizedType' and 'TemplatizedFunctionCall'.

Also, we now parse function calls as secondary expressions.
This commit is contained in:
Itamar 2021-04-06 19:43:43 +03:00 committed by Andreas Kling
parent 510b5073de
commit 9e2e36724d
5 changed files with 96 additions and 184 deletions

View file

@ -398,22 +398,16 @@ struct TargetDeclaration {
static Optional<TargetDeclaration> get_target_declaration(const ASTNode& node)
{
dbgln("get_target_declaration");
if (!node.is_identifier()) {
dbgln_if(CPP_LANGUAGE_SERVER_DEBUG, "node is not an identifier");
return {};
}
const ASTNode* n = &node;
while (n) {
dbgln("{}", n->class_name());
n = n->parent();
}
String name = static_cast<const Identifier&>(node).m_name;
if ((node.parent() && node.parent()->is_function_call()) || (node.parent()->is_name() && node.parent()->parent() && node.parent()->parent()->is_function_call()))
if ((node.parent() && node.parent()->is_function_call()) || (node.parent()->is_name() && node.parent()->parent() && node.parent()->parent()->is_function_call())) {
return TargetDeclaration { TargetDeclaration::Type::Function, name };
}
if ((node.parent() && node.parent()->is_type()) || (node.parent()->is_name() && node.parent()->parent() && node.parent()->parent()->is_type()))
return TargetDeclaration { TargetDeclaration::Type::Type, name };