mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
C++, minor fixes
This commit is contained in:
@@ -577,7 +577,7 @@ _id_explicit_cast = {
|
||||
|
||||
|
||||
class NoOldIdError(Exception):
|
||||
# Used to avoid implementing unneeded id generation for old id schmes.
|
||||
# Used to avoid implementing unneeded id generation for old id schemes.
|
||||
@property
|
||||
def description(self):
|
||||
# type: () -> str
|
||||
@@ -2626,6 +2626,7 @@ class ASTDeclSpecsSimple(ASTBase):
|
||||
|
||||
class ASTDeclSpecs(ASTBase):
|
||||
def __init__(self, outer, leftSpecs, rightSpecs, trailing):
|
||||
# type: (Any, ASTDeclSpecsSimple, ASTDeclSpecsSimple, Any) -> None
|
||||
# leftSpecs and rightSpecs are used for output
|
||||
# allSpecs are used for id generation
|
||||
self.outer = outer
|
||||
@@ -2663,8 +2664,6 @@ class ASTDeclSpecs(ASTBase):
|
||||
res = [] # type: List[str]
|
||||
l = transform(self.leftSpecs)
|
||||
if len(l) > 0:
|
||||
if len(res) > 0:
|
||||
res.append(" ")
|
||||
res.append(l)
|
||||
if self.trailingTypeSpec:
|
||||
if len(res) > 0:
|
||||
|
||||
@@ -194,6 +194,7 @@ def test_expressions():
|
||||
exprCheck('new int[42]', 'nw_AL42E_iE')
|
||||
exprCheck('new int()', 'nw_ipiE')
|
||||
exprCheck('new int(5, 42)', 'nw_ipiL5EL42EE')
|
||||
exprCheck('::new int', 'nw_iE')
|
||||
# delete-expression
|
||||
exprCheck('delete p', 'dl1p')
|
||||
exprCheck('delete [] p', 'da1p')
|
||||
@@ -334,6 +335,8 @@ def test_member_definitions():
|
||||
|
||||
|
||||
def test_function_definitions():
|
||||
check('function', 'void f(volatile int)', {1: "f__iV", 2: "1fVi"})
|
||||
check('function', 'void f(std::size_t)', {1: "f__std::s", 2: "1fNSt6size_tE"})
|
||||
check('function', 'operator bool() const', {1: "castto-b-operatorC", 2: "NKcvbEv"})
|
||||
check('function', 'A::operator bool() const',
|
||||
{1: "A::castto-b-operatorC", 2: "NK1AcvbEv"})
|
||||
@@ -559,6 +562,7 @@ def test_anon_definitions():
|
||||
check('union', '@a', {3: "Ut1_a"})
|
||||
check('enum', '@a', {3: "Ut1_a"})
|
||||
check('class', '@1', {3: "Ut1_1"})
|
||||
check('class', '@a::A', {3: "NUt1_a1AE"})
|
||||
|
||||
|
||||
def test_templates():
|
||||
@@ -704,6 +708,9 @@ def test_attributes():
|
||||
check('function', 'static inline __attribute__(()) void f()',
|
||||
{1: 'f', 2: '1fv'},
|
||||
output='__attribute__(()) static inline void f()')
|
||||
check('function', '[[attr1]] [[attr2]] void f()',
|
||||
{1: 'f', 2: '1fv'},
|
||||
output='[[attr1]] [[attr2]] void f()')
|
||||
# position: declarator
|
||||
check('member', 'int *[[attr]] i', {1: 'i__iP', 2:'1i'})
|
||||
check('member', 'int *const [[attr]] volatile i', {1: 'i__iPVC', 2: '1i'},
|
||||
|
||||
Reference in New Issue
Block a user