From f08e270f5aff77f010cd0eddb7791a38c4c6437a Mon Sep 17 00:00:00 2001 From: guoxianzhe <53285945+guoxianzhe@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:53:30 +0800 Subject: [PATCH] add is_variadic to method (#56) for variadic function --- cxx-parser/cxx/terra/include/terra.hpp | 2 ++ cxx-parser/cxx/terra/include/terra_node.hpp | 3 ++- cxx-parser/src/cxx_terra_node.ts | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cxx-parser/cxx/terra/include/terra.hpp b/cxx-parser/cxx/terra/include/terra.hpp index d5ee87b..c1472e2 100644 --- a/cxx-parser/cxx/terra/include/terra.hpp +++ b/cxx-parser/cxx/terra/include/terra.hpp @@ -359,6 +359,7 @@ namespace terra method.is_overriding = cppast::is_overriding(cpp_member_function.virtual_info()); method.is_const = cpp_member_function.cv_qualifier() == cppast::cpp_cv::cpp_cv_const; method.signature = cpp_member_function.signature(); + method.is_variadic = cpp_member_function.is_variadic(); } void parse_constructor( @@ -1169,6 +1170,7 @@ namespace terra json["is_overriding"] = node->is_overriding; json["is_const"] = node->is_const; json["signature"] = node->signature; + json["is_variadic"] = node->is_variadic; } void Variable2Json(Variable *node, nlohmann::json &json) diff --git a/cxx-parser/cxx/terra/include/terra_node.hpp b/cxx-parser/cxx/terra/include/terra_node.hpp index 5581573..ab54434 100644 --- a/cxx-parser/cxx/terra/include/terra_node.hpp +++ b/cxx-parser/cxx/terra/include/terra_node.hpp @@ -129,8 +129,9 @@ namespace terra bool is_overriding; bool is_const; std::string signature; + bool is_variadic; } MemberFunction; - NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(MemberFunction, name, is_virtual, return_type, parameters, access_specifier, is_overriding, signature, namespaces, file_path); + NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(MemberFunction, name, is_virtual, return_type, parameters, access_specifier, is_overriding, signature, is_variadic, namespaces, file_path); typedef struct MemberVariable : BaseNode { diff --git a/cxx-parser/src/cxx_terra_node.ts b/cxx-parser/src/cxx_terra_node.ts index 50cbfeb..231870b 100644 --- a/cxx-parser/src/cxx_terra_node.ts +++ b/cxx-parser/src/cxx_terra_node.ts @@ -244,6 +244,7 @@ export class MemberFunction extends CXXTerraNode { is_overriding: boolean = false; is_const: boolean = false; signature: string = ''; + is_variadic: boolean = false; override get fullName(): string { return `${this.parent?.fullName}.${this.name}`;