mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Deduplicate base classes from Doxygen using declaration (#56218)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56218 Changelog: [Internal] When a class inherits constructors via `using Base::Base;`, Doxygen incorrectly emits duplicate `basecompoundref` entries for the same base class. This caused base classes like `ConverterBase` to appear twice in the snapshot output. This diff deduplicates base classes by name in `get_base_classes()`. Reviewed By: cipolleschi Differential Revision: D98118659 fbshipit-source-id: c81f663480fda48c89e6dd625a504a78eb9d7c41
This commit is contained in:
1 parent
31f262ed2e
commit
015cd13ab1
3 files changed
+48
No files matched your search
@@ -166,8 +166,14 @@ def get_base_classes(
|
||||
) -> list:
|
||||
"""
|
||||
Get the base classes of a compound object.
|
||||
|
||||
Deduplicates base classes by name. Doxygen can emit duplicate
|
||||
``basecompoundref`` entries when a class inherits constructors via
|
||||
``using Base::Base;`` — the using-declaration is incorrectly reported
|
||||
as an additional base class reference.
|
||||
"""
|
||||
base_classes = []
|
||||
seen_names: set[str] = set()
|
||||
if compound_object.basecompoundref:
|
||||
for base in compound_object.basecompoundref:
|
||||
# base is a compoundRefType with:
|
||||
@@ -184,6 +190,10 @@ def get_base_classes(
|
||||
# Ignore private base classes
|
||||
continue
|
||||
|
||||
if base_name in seen_names:
|
||||
continue
|
||||
seen_names.add(base_name)
|
||||
|
||||
base_classes.append(
|
||||
base_class(
|
||||
base_name,
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
struct test::Converter<int> : public test::ConverterBase<int> {
|
||||
public void doSomething();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct test::Converter {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct test::ConverterBase {
|
||||
public ConverterBase() = default;
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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 {
|
||||
|
||||
template <typename T>
|
||||
struct ConverterBase {
|
||||
ConverterBase() = default;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct Converter {};
|
||||
|
||||
template <>
|
||||
struct Converter<int> : public ConverterBase<int> {
|
||||
using ConverterBase<int>::ConverterBase;
|
||||
void doSomething();
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
Reference in new issue
Block a user