mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Added support for noexcept specifiers
This commit is contained in:
parent
5542003e96
commit
794e241ba5
@ -426,13 +426,14 @@ class MemberObjDefExpr(NamedDefExpr):
|
|||||||
class FuncDefExpr(NamedDefExpr):
|
class FuncDefExpr(NamedDefExpr):
|
||||||
|
|
||||||
def __init__(self, name, visibility, static, explicit, constexpr, rv,
|
def __init__(self, name, visibility, static, explicit, constexpr, rv,
|
||||||
signature, const, pure_virtual):
|
signature, const, noexcept, pure_virtual):
|
||||||
NamedDefExpr.__init__(self, name, visibility, static)
|
NamedDefExpr.__init__(self, name, visibility, static)
|
||||||
self.rv = rv
|
self.rv = rv
|
||||||
self.signature = signature
|
self.signature = signature
|
||||||
self.explicit = explicit
|
self.explicit = explicit
|
||||||
self.constexpr = constexpr
|
self.constexpr = constexpr
|
||||||
self.const = const
|
self.const = const
|
||||||
|
self.noexcept = noexcept
|
||||||
self.pure_virtual = pure_virtual
|
self.pure_virtual = pure_virtual
|
||||||
|
|
||||||
def get_id(self):
|
def get_id(self):
|
||||||
@ -456,6 +457,8 @@ class FuncDefExpr(NamedDefExpr):
|
|||||||
map(unicode, self.signature))))
|
map(unicode, self.signature))))
|
||||||
if self.const:
|
if self.const:
|
||||||
buf.append(u'const')
|
buf.append(u'const')
|
||||||
|
if self.noexcept:
|
||||||
|
buf.append(u'noexcept')
|
||||||
if self.pure_virtual:
|
if self.pure_virtual:
|
||||||
buf.append(u'= 0')
|
buf.append(u'= 0')
|
||||||
return u' '.join(buf)
|
return u' '.join(buf)
|
||||||
@ -776,6 +779,7 @@ class DefinitionParser(object):
|
|||||||
args.append(ArgumentDefExpr(argtype, argname, default))
|
args.append(ArgumentDefExpr(argtype, argname, default))
|
||||||
self.skip_ws()
|
self.skip_ws()
|
||||||
const = self.skip_word_and_ws('const')
|
const = self.skip_word_and_ws('const')
|
||||||
|
noexcept = self.skip_word_and_ws('noexcept')
|
||||||
if self.skip_string('='):
|
if self.skip_string('='):
|
||||||
self.skip_ws()
|
self.skip_ws()
|
||||||
if not (self.skip_string('0') or \
|
if not (self.skip_string('0') or \
|
||||||
@ -787,7 +791,7 @@ class DefinitionParser(object):
|
|||||||
pure_virtual = True
|
pure_virtual = True
|
||||||
else:
|
else:
|
||||||
pure_virtual = False
|
pure_virtual = False
|
||||||
return args, const, pure_virtual
|
return args, const, noexcept, pure_virtual
|
||||||
|
|
||||||
def _parse_visibility_static(self):
|
def _parse_visibility_static(self):
|
||||||
visibility = 'public'
|
visibility = 'public'
|
||||||
|
@ -54,6 +54,9 @@ def test_type_definitions():
|
|||||||
x = 'constexpr int get_value()'
|
x = 'constexpr int get_value()'
|
||||||
assert unicode(parse('function', x)) == x
|
assert unicode(parse('function', x)) == x
|
||||||
|
|
||||||
|
x = 'int get_value() const noexcept'
|
||||||
|
assert unicode(parse('function', x)) == x
|
||||||
|
|
||||||
|
|
||||||
def test_operators():
|
def test_operators():
|
||||||
x = parse('function', 'void operator new [ ] ()')
|
x = parse('function', 'void operator new [ ] ()')
|
||||||
|
Loading…
Reference in New Issue
Block a user