mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
C++, fix parsing of function types in other types.
Let all kinds of function parameters be allowed to have a name. Fixes michaeljones/breathe#267.
This commit is contained in:
parent
4cf78e608e
commit
65dddfcd69
@ -3011,10 +3011,9 @@ class DefinitionParser(object):
|
||||
self.fail('Expected ")" after "..." in '
|
||||
'parameters_and_qualifiers.')
|
||||
break
|
||||
if paramMode == 'function':
|
||||
arg = self._parse_type_with_init(outer=None, named='single')
|
||||
else:
|
||||
arg = self._parse_type(named=False)
|
||||
# note: it seems that function arguments can always sbe named,
|
||||
# even in function pointers and similar.
|
||||
arg = self._parse_type_with_init(outer=None, named='single')
|
||||
# TODO: parse default parameters # TODO: didn't we just do that?
|
||||
args.append(ASTFunctinoParameter(arg))
|
||||
|
||||
|
@ -132,6 +132,11 @@ def test_type_definitions():
|
||||
|
||||
check('type', 'A = B', None, '1A')
|
||||
|
||||
# from breathe#267 (named function parameters for function pointers
|
||||
check('type', 'void (*gpio_callback_t)(struct device *port, uint32_t pin)',
|
||||
'gpio_callback_t', '15gpio_callback_t')
|
||||
check('type', 'void (*f)(std::function<void(int i)> g)', 'f', '1f')
|
||||
|
||||
|
||||
def test_member_definitions():
|
||||
check('member', ' const std::string & name = 42',
|
||||
|
Loading…
Reference in New Issue
Block a user