Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion scripts/cxx-api/parser/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def get_variable_member(
if initializer_type == InitializerType.BRACE:
is_brace_initializer = True

return VariableMember(
member = VariableMember(
variable_name,
variable_type,
visibility,
Expand All @@ -263,6 +263,10 @@ def get_variable_member(
is_brace_initializer,
)

member.add_template(get_template_params(member_def))

return member


def get_doxygen_params(
function_def: compound.MemberdefType,
Expand Down Expand Up @@ -313,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))

Expand Down
3 changes: 3 additions & 0 deletions scripts/cxx-api/parser/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def to_string(

result = " " * indent

if self.template_list is not None:
result += self.template_list.to_string() + "\n" + " " * indent

if not hide_visibility:
result += self.visibility + " "

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
template <typename T>
const test::Strct<T> test::Strct<T>::VALUE;

template <typename T>
struct test::Strct {
public static const test::Strct<T> VALUE;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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 Strct {
static const Strct<T> VALUE;
};

template <typename T>
const Strct<T> Strct<T>::VALUE = {};

} // namespace test
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
constexpr T test::default_value;
constexpr test::MyType test::default_value<test::MyType>;
template <typename T>
constexpr T test::default_value;
template <typename T>
T* test::null_ptr;
test::MyType* test::null_ptr<test::MyType>;

Expand Down
Loading