Skip to content

Commit

Permalink
Merge pull request #737 from rogerbarton/dev
Browse files Browse the repository at this point in the history
Fix sphinxrenderer.py variable and function visitors for C#
  • Loading branch information
michaeljones authored Sep 21, 2021
2 parents a06ad44 + fc0d085 commit 943534f
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1845,11 +1845,18 @@ def visit_function(self, node) -> List[Node]:
name = self.join_nested_name(names)
if dom == 'py':
declaration = name + node.get_argsstring()
elif dom == 'cs':
declaration = ' '.join([
self.create_template_prefix(node),
''.join(n.astext() for n in self.render(node.get_type())), # type: ignore
name,
node.get_argsstring()
])
else:
elements = [self.create_template_prefix(node)]
if node.static == 'yes':
elements.append('static')
if node.inline == 'yes' and dom != 'cs':
if node.inline == 'yes':
elements.append('inline')
if node.kind == 'friend':
elements.append('friend')
Expand Down Expand Up @@ -2013,6 +2020,21 @@ def visit_variable(self, node) -> List[Node]:
initializer = self.make_initializer(node).strip().lstrip('=').strip()
if len(initializer) != 0:
options['value'] = initializer
elif dom == 'cs':
declaration = ' '.join([
self.create_template_prefix(node),
''.join(n.astext() for n in self.render(node.get_type())), # type: ignore
name,
node.get_argsstring()
])
if node.get_gettable() or node.get_settable():
declaration += '{'
if node.get_gettable():
declaration += 'get;'
if node.get_settable():
declaration += 'set;'
declaration += '}'
declaration += self.make_initializer(node)
else:
elements = [self.create_template_prefix(node)]
if node.static == 'yes':
Expand All @@ -2022,19 +2044,9 @@ def visit_variable(self, node) -> List[Node]:
typename = ''.join(n.astext() for n in self.render(node.get_type()))
if dom == 'c' and '::' in typename:
typename = typename.replace('::', '.')
elif dom == 'cs':
typename = typename.replace(' ', '')
elements.append(typename)
elements.append(name)
elements.append(node.get_argsstring())
if dom == 'cs':
if node.get_gettable() or node.get_settable():
elements.append('{')
if node.get_gettable():
elements.append('get;')
if node.get_settable():
elements.append('set;')
elements.append('}')
elements.append(self.make_initializer(node))
declaration = ' '.join(elements)
if not dom or dom in ('c', 'cpp', 'py', 'cs'):
Expand Down

0 comments on commit 943534f

Please sign in to comment.