Remove incorrect qualification from function parameters (#55971)

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

Changelog: [Internal]

Doxygen incorrectly transforms parameter names to references if they match a member. This diff strips the resulting invalid qualification from the type.

Reviewed By: cipolleschi

Differential Revision: D95548542

fbshipit-source-id: c1e475f10e07af6a4076336cab0d3cbe0da342e5
This commit is contained in:
Jakub Piasecki authored and meta-codesync[bot] committed 2026-03-08 23:52:42 -07:00
1 parent 6d19a27a31
commit 41a1941961
4 files changed
+58

No files matched your search

@@ -297,6 +297,13 @@ def _parse_single_argument(arg: str) -> Argument:
)
):
return (qualifiers, base_arg, None, default_value)
# C++ parameter names cannot contain "::". Doxygen may
# incorrectly cross-reference a parameter name to a member
# variable, producing a qualified path (e.g. "bool
# ns::Class::isActive" instead of "bool isActive"). Strip
# the namespace prefix to recover the original name.
if "::" in potential_name:
potential_name = potential_name.rsplit("::", 1)[-1]
return (qualifiers, prefix, potential_name, default_value)
else:
return (qualifiers, base_arg, None, default_value)
@@ -0,0 +1,5 @@
class test::Tracer {
public bool isActive;
public uint32_t subscribe(test::Tracer::StateCallback callback);
public using StateCallback = void(*)(bool isActive);
}
@@ -0,0 +1,19 @@
/*
* 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 test {
class Tracer {
public:
bool isActive;
using StateCallback = void (*)(bool isActive);
uint32_t subscribe(StateCallback callback);
};
} // namespace test
@@ -374,6 +374,33 @@ class TestParseArgString(unittest.TestCase):
self.assertTrue(mods.is_noexcept)
self.assertTrue(mods.is_override)
# =========================================================================
# Qualified parameter names (Doxygen cross-reference cleanup)
# =========================================================================
def test_qualified_parameter_name_stripped(self):
"""Parameter names containing '::' should be stripped to base name.
Doxygen may incorrectly cross-reference parameter names to member
variables, producing qualified paths like 'ns::Class::paramName'.
C++ parameter names cannot contain '::', so the qualification must
be stripped to just the base name.
"""
args, mods = parse_arg_string(
"(bool facebook::react::PerformanceTracer::isTracing)"
)
self.assertEqual(args, [(None, "bool", "isTracing", None)])
def test_qualified_parameter_name_simple(self):
"""Simple qualified parameter name: test::Foo::value"""
args, mods = parse_arg_string("(int test::Foo::value)")
self.assertEqual(args, [(None, "int", "value", None)])
def test_unqualified_parameter_name_unchanged(self):
"""Regular parameter names without '::' should not be affected."""
args, mods = parse_arg_string("(bool isActive)")
self.assertEqual(args, [(None, "bool", "isActive", None)])
if __name__ == "__main__":
unittest.main()