Fix handling of member function pointers in the API snapshot (#56069)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56069

Changelog: [Internal]

Fixes handling of member function pointers in the C++ Api snapshot.

Reviewed By: cipolleschi

Differential Revision: D96279461

fbshipit-source-id: 42e7b004878eedfbbb8504345165bb1d60acde78
This commit is contained in:
Dawid Małecki authored and meta-codesync[bot] committed 2026-03-18 09:29:02 -07:00
1 parent 882dbe0118
commit d0ec2956f8
3 files changed
+42

No files matched your search

+15
View File
@@ -317,6 +317,21 @@ def get_doxygen_params(
else:
param_type += param_array
# Handle pointer-to-member-function types where the name must be
# embedded inside the declarator group. Doxygen gives:
# type = "void(ns::*)() const", name = "asFoo"
# We need to produce:
# "void(ns::*asFoo)() const"
if param_name:
m = re.search(r"\([^)]*::\*\)", param_type)
if m:
# Insert name before the closing ')' of the ptr-to-member group
insert_pos = m.end() - 1
param_type = (
param_type[:insert_pos] + param_name + param_type[insert_pos:]
)
param_name = None
qualifiers, core_type = extract_qualifiers(param_type)
arguments.append((qualifiers, core_type, param_name, param_default))
@@ -0,0 +1,6 @@
struct folly::dynamic {
}
template <typename R, typename... T>
R test::jsArg(const folly::dynamic& arg, R(folly::dynamic::*asFoo)() const, const T &... desc);
@@ -0,0 +1,21 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
namespace folly {
struct dynamic {};
} // namespace folly
namespace test {
template <typename R, typename... T>
R jsArg(const folly::dynamic &arg, R (folly::dynamic::*asFoo)() const, const T &...desc);
} // namespace test