mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +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:
parent
510b5073de
commit
9e2e36724d
Notes:
sideshowbarker
2024-07-18 20:41:06 +09:00
Author: https://github.com/itamar8910
Commit: 9e2e36724d
Pull-request: https://github.com/SerenityOS/serenity/pull/6009
5 changed files with 96 additions and 184 deletions
|
@ -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 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue