Sphinx 7.1.1__py3-none-any.whl → 7.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of Sphinx might be problematic. Click here for more details.
- sphinx/__init__.py +6 -6
- sphinx/__main__.py +3 -1
- sphinx/addnodes.py +35 -22
- sphinx/application.py +40 -38
- sphinx/builders/__init__.py +16 -12
- sphinx/builders/_epub_base.py +15 -11
- sphinx/builders/changes.py +6 -4
- sphinx/builders/dirhtml.py +4 -2
- sphinx/builders/dummy.py +6 -4
- sphinx/builders/epub3.py +16 -8
- sphinx/builders/gettext.py +40 -43
- sphinx/builders/html/__init__.py +166 -196
- sphinx/builders/html/_assets.py +116 -0
- sphinx/builders/html/transforms.py +4 -2
- sphinx/builders/latex/__init__.py +12 -7
- sphinx/builders/latex/theming.py +5 -2
- sphinx/builders/latex/transforms.py +6 -3
- sphinx/builders/linkcheck.py +21 -13
- sphinx/builders/manpage.py +6 -4
- sphinx/builders/singlehtml.py +16 -9
- sphinx/builders/texinfo.py +11 -6
- sphinx/builders/text.py +8 -3
- sphinx/builders/xml.py +9 -4
- sphinx/cmd/build.py +27 -14
- sphinx/cmd/make_mode.py +13 -4
- sphinx/cmd/quickstart.py +13 -4
- sphinx/config.py +17 -14
- sphinx/deprecation.py +4 -2
- sphinx/directives/__init__.py +44 -12
- sphinx/directives/code.py +5 -4
- sphinx/directives/other.py +92 -44
- sphinx/directives/patches.py +1 -1
- sphinx/domains/__init__.py +11 -8
- sphinx/domains/c.py +67 -57
- sphinx/domains/changeset.py +3 -2
- sphinx/domains/citation.py +2 -1
- sphinx/domains/cpp.py +136 -93
- sphinx/domains/index.py +9 -5
- sphinx/domains/javascript.py +32 -19
- sphinx/domains/math.py +5 -3
- sphinx/domains/python.py +69 -57
- sphinx/domains/rst.py +20 -11
- sphinx/domains/std.py +21 -15
- sphinx/environment/__init__.py +97 -65
- sphinx/environment/adapters/indexentries.py +13 -10
- sphinx/environment/adapters/toctree.py +485 -308
- sphinx/environment/collectors/__init__.py +3 -4
- sphinx/environment/collectors/asset.py +10 -4
- sphinx/environment/collectors/dependencies.py +7 -4
- sphinx/environment/collectors/metadata.py +7 -5
- sphinx/environment/collectors/title.py +5 -3
- sphinx/environment/collectors/toctree.py +13 -8
- sphinx/errors.py +1 -1
- sphinx/events.py +5 -5
- sphinx/ext/apidoc.py +49 -27
- sphinx/ext/autodoc/__init__.py +179 -161
- sphinx/ext/autodoc/directive.py +10 -6
- sphinx/ext/autodoc/importer.py +22 -13
- sphinx/ext/autodoc/mock.py +4 -1
- sphinx/ext/autodoc/preserve_defaults.py +80 -12
- sphinx/ext/autodoc/type_comment.py +14 -10
- sphinx/ext/autodoc/typehints.py +7 -3
- sphinx/ext/autosectionlabel.py +6 -3
- sphinx/ext/autosummary/__init__.py +21 -15
- sphinx/ext/autosummary/generate.py +176 -126
- sphinx/ext/coverage.py +93 -8
- sphinx/ext/doctest.py +28 -17
- sphinx/ext/duration.py +19 -17
- sphinx/ext/extlinks.py +11 -6
- sphinx/ext/githubpages.py +8 -7
- sphinx/ext/graphviz.py +61 -17
- sphinx/ext/ifconfig.py +7 -4
- sphinx/ext/imgconverter.py +4 -2
- sphinx/ext/imgmath.py +29 -23
- sphinx/ext/inheritance_diagram.py +41 -27
- sphinx/ext/intersphinx.py +45 -38
- sphinx/ext/linkcode.py +8 -5
- sphinx/ext/mathjax.py +13 -9
- sphinx/ext/napoleon/__init__.py +3 -3
- sphinx/ext/napoleon/docstring.py +40 -31
- sphinx/ext/todo.py +10 -7
- sphinx/ext/viewcode.py +46 -25
- sphinx/extension.py +1 -1
- sphinx/highlighting.py +20 -12
- sphinx/io.py +5 -4
- sphinx/jinja2glue.py +24 -19
- sphinx/locale/__init__.py +8 -2
- sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ar/LC_MESSAGES/sphinx.po +756 -740
- sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/bg/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/bn/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ca/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cak/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cs/LC_MESSAGES/sphinx.po +758 -742
- sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cy/LC_MESSAGES/sphinx.po +759 -743
- sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/da/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/de/LC_MESSAGES/sphinx.po +759 -743
- sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/el/LC_MESSAGES/sphinx.po +763 -747
- sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/eo/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/es/LC_MESSAGES/sphinx.po +767 -751
- sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/et/LC_MESSAGES/sphinx.po +762 -746
- sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/eu/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fa/LC_MESSAGES/sphinx.po +766 -750
- sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fi/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fr/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/gl/LC_MESSAGES/sphinx.js +60 -0
- sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/gl/LC_MESSAGES/sphinx.po +3695 -0
- sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/he/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hi/LC_MESSAGES/sphinx.po +763 -747
- sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hr/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hu/LC_MESSAGES/sphinx.po +759 -743
- sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/id/LC_MESSAGES/sphinx.po +765 -749
- sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/is/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/it/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ja/LC_MESSAGES/sphinx.po +767 -751
- sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ka/LC_MESSAGES/sphinx.po +759 -743
- sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ko/LC_MESSAGES/sphinx.po +767 -751
- sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/lt/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/lv/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/mk/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ne/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/nl/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pl/LC_MESSAGES/sphinx.po +762 -745
- sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ro/LC_MESSAGES/sphinx.po +759 -743
- sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ru/LC_MESSAGES/sphinx.po +760 -744
- sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/si/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sk/LC_MESSAGES/sphinx.po +765 -749
- sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sl/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/sphinx.pot +748 -740
- sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sq/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sr/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/sr@latin/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sr@latin/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/sr_RS/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sr_RS/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sv/LC_MESSAGES/sphinx.po +755 -739
- sphinx/locale/ta/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ta/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/te/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/tr/LC_MESSAGES/sphinx.po +763 -747
- sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +760 -749
- sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ur/LC_MESSAGES/sphinx.po +759 -748
- sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/vi/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/yue/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/zh_CN/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po +768 -752
- sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +754 -738
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +767 -751
- sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +754 -738
- sphinx/parsers.py +5 -4
- sphinx/project.py +52 -34
- sphinx/pycode/__init__.py +2 -1
- sphinx/pycode/ast.py +7 -13
- sphinx/pycode/parser.py +42 -38
- sphinx/registry.py +35 -29
- sphinx/roles.py +9 -4
- sphinx/search/__init__.py +5 -17
- sphinx/search/da.py +1 -1
- sphinx/search/de.py +1 -1
- sphinx/search/en.py +1 -1
- sphinx/search/es.py +1 -1
- sphinx/search/fi.py +1 -1
- sphinx/search/fr.py +1 -1
- sphinx/search/hu.py +1 -1
- sphinx/search/it.py +1 -1
- sphinx/search/ja.py +1 -1
- sphinx/search/nl.py +1 -1
- sphinx/search/no.py +1 -1
- sphinx/search/pt.py +1 -1
- sphinx/search/ro.py +1 -1
- sphinx/search/ru.py +1 -1
- sphinx/search/sv.py +1 -1
- sphinx/search/tr.py +1 -1
- sphinx/search/zh.py +1 -1
- sphinx/testing/fixtures.py +23 -30
- sphinx/testing/path.py +9 -0
- sphinx/testing/restructuredtext.py +13 -5
- sphinx/testing/util.py +20 -63
- sphinx/texinputs/sphinxlatexobjects.sty +15 -15
- sphinx/themes/agogo/static/agogo.css_t +10 -4
- sphinx/themes/basic/layout.html +1 -1
- sphinx/themes/basic/static/basic.css_t +4 -0
- sphinx/themes/basic/static/documentation_options.js_t +1 -2
- sphinx/themes/basic/static/searchtools.js +17 -9
- sphinx/themes/basic/static/sphinx_highlight.js +13 -3
- sphinx/themes/bizstyle/static/bizstyle.css_t +4 -0
- sphinx/themes/classic/theme.conf +1 -1
- sphinx/themes/epub/static/epub.css_t +6 -1
- sphinx/themes/haiku/theme.conf +1 -1
- sphinx/themes/nature/static/nature.css_t +4 -0
- sphinx/themes/nonav/static/nonav.css_t +6 -1
- sphinx/themes/pyramid/static/pyramid.css_t +4 -0
- sphinx/themes/scrolls/static/scrolls.css_t +4 -0
- sphinx/themes/scrolls/theme.conf +1 -1
- sphinx/themes/sphinxdoc/static/sphinxdoc.css_t +4 -0
- sphinx/theming.py +9 -7
- sphinx/transforms/__init__.py +79 -3
- sphinx/transforms/compact_bullet_list.py +6 -3
- sphinx/transforms/i18n.py +26 -10
- sphinx/transforms/post_transforms/__init__.py +21 -8
- sphinx/transforms/post_transforms/code.py +6 -3
- sphinx/transforms/post_transforms/images.py +13 -9
- sphinx/util/__init__.py +21 -92
- sphinx/util/cfamily.py +7 -4
- sphinx/util/display.py +3 -2
- sphinx/util/docfields.py +7 -6
- sphinx/util/docstrings.py +1 -1
- sphinx/util/docutils.py +41 -31
- sphinx/util/fileutil.py +9 -6
- sphinx/util/i18n.py +21 -18
- sphinx/util/images.py +2 -1
- sphinx/util/index_entries.py +27 -0
- sphinx/util/inspect.py +83 -67
- sphinx/util/inventory.py +4 -2
- sphinx/util/logging.py +9 -6
- sphinx/util/matching.py +5 -2
- sphinx/util/math.py +6 -3
- sphinx/util/nodes.py +70 -31
- sphinx/util/osutil.py +22 -40
- sphinx/util/parallel.py +4 -1
- sphinx/util/rst.py +7 -3
- sphinx/util/tags.py +11 -4
- sphinx/util/template.py +17 -14
- sphinx/util/typing.py +61 -20
- sphinx/versioning.py +6 -4
- sphinx/writers/html.py +1 -1
- sphinx/writers/html5.py +32 -24
- sphinx/writers/latex.py +67 -53
- sphinx/writers/manpage.py +9 -5
- sphinx/writers/texinfo.py +11 -9
- sphinx/writers/text.py +14 -9
- sphinx/writers/xml.py +3 -2
- {sphinx-7.1.1.dist-info → sphinx-7.2.0.dist-info}/METADATA +7 -5
- sphinx-7.2.0.dist-info/RECORD +568 -0
- sphinx/testing/comparer.py +0 -97
- sphinx-7.1.1.dist-info/RECORD +0 -564
- {sphinx-7.1.1.dist-info → sphinx-7.2.0.dist-info}/LICENSE +0 -0
- {sphinx-7.1.1.dist-info → sphinx-7.2.0.dist-info}/WHEEL +0 -0
- {sphinx-7.1.1.dist-info → sphinx-7.2.0.dist-info}/entry_points.txt +0 -0
sphinx/domains/cpp.py
CHANGED
|
@@ -3,19 +3,14 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import re
|
|
6
|
-
from typing import Any, Callable,
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Callable, TypeVar
|
|
7
7
|
|
|
8
8
|
from docutils import nodes
|
|
9
|
-
from docutils.nodes import Element, Node, TextElement, system_message
|
|
10
9
|
from docutils.parsers.rst import directives
|
|
11
10
|
|
|
12
11
|
from sphinx import addnodes
|
|
13
|
-
from sphinx.addnodes import desc_signature, pending_xref
|
|
14
|
-
from sphinx.application import Sphinx
|
|
15
|
-
from sphinx.builders import Builder
|
|
16
12
|
from sphinx.directives import ObjectDescription
|
|
17
13
|
from sphinx.domains import Domain, ObjType
|
|
18
|
-
from sphinx.environment import BuildEnvironment
|
|
19
14
|
from sphinx.errors import NoUri
|
|
20
15
|
from sphinx.locale import _, __
|
|
21
16
|
from sphinx.roles import SphinxRole, XRefRole
|
|
@@ -46,7 +41,17 @@ from sphinx.util.cfamily import (
|
|
|
46
41
|
from sphinx.util.docfields import Field, GroupedField
|
|
47
42
|
from sphinx.util.docutils import SphinxDirective
|
|
48
43
|
from sphinx.util.nodes import make_refnode
|
|
49
|
-
|
|
44
|
+
|
|
45
|
+
if TYPE_CHECKING:
|
|
46
|
+
from collections.abc import Generator, Iterator
|
|
47
|
+
|
|
48
|
+
from docutils.nodes import Element, Node, TextElement, system_message
|
|
49
|
+
|
|
50
|
+
from sphinx.addnodes import desc_signature, pending_xref
|
|
51
|
+
from sphinx.application import Sphinx
|
|
52
|
+
from sphinx.builders import Builder
|
|
53
|
+
from sphinx.environment import BuildEnvironment
|
|
54
|
+
from sphinx.util.typing import OptionSpec
|
|
50
55
|
|
|
51
56
|
logger = logging.getLogger(__name__)
|
|
52
57
|
T = TypeVar('T')
|
|
@@ -610,12 +615,15 @@ class ASTIdentifier(ASTBase):
|
|
|
610
615
|
assert len(identifier) != 0
|
|
611
616
|
self.identifier = identifier
|
|
612
617
|
|
|
618
|
+
def _stringify(self, transform: StringifyTransform) -> str:
|
|
619
|
+
return transform(self.identifier)
|
|
620
|
+
|
|
613
621
|
def is_anon(self) -> bool:
|
|
614
622
|
return self.identifier[0] == '@'
|
|
615
623
|
|
|
616
624
|
def get_id(self, version: int) -> str:
|
|
617
625
|
if self.is_anon() and version < 3:
|
|
618
|
-
raise NoOldIdError
|
|
626
|
+
raise NoOldIdError
|
|
619
627
|
if version == 1:
|
|
620
628
|
if self.identifier == 'size_t':
|
|
621
629
|
return 's'
|
|
@@ -769,15 +777,18 @@ class ASTNestedName(ASTBase):
|
|
|
769
777
|
# just print the name part, with template args, not template params
|
|
770
778
|
if mode == 'noneIsName':
|
|
771
779
|
if self.rooted:
|
|
772
|
-
|
|
780
|
+
unreachable = "Can this happen?"
|
|
781
|
+
raise AssertionError(unreachable) # TODO
|
|
773
782
|
signode += nodes.Text('::')
|
|
774
783
|
for i in range(len(self.names)):
|
|
775
784
|
if i != 0:
|
|
776
|
-
|
|
785
|
+
unreachable = "Can this happen?"
|
|
786
|
+
raise AssertionError(unreachable) # TODO
|
|
777
787
|
signode += nodes.Text('::blah')
|
|
778
788
|
n = self.names[i]
|
|
779
789
|
if self.templates[i]:
|
|
780
|
-
|
|
790
|
+
unreachable = "Can this happen?"
|
|
791
|
+
raise AssertionError(unreachable) # TODO
|
|
781
792
|
signode += nodes.Text("template")
|
|
782
793
|
signode += nodes.Text(" ")
|
|
783
794
|
n.describe_signature(signode, mode, env, '', symbol)
|
|
@@ -1401,7 +1412,7 @@ class ASTNewExpr(ASTExpression):
|
|
|
1401
1412
|
if self.isNewTypeId:
|
|
1402
1413
|
res.append(transform(self.typ))
|
|
1403
1414
|
else:
|
|
1404
|
-
raise AssertionError
|
|
1415
|
+
raise AssertionError
|
|
1405
1416
|
if self.initList is not None:
|
|
1406
1417
|
res.append(transform(self.initList))
|
|
1407
1418
|
return ''.join(res)
|
|
@@ -1428,7 +1439,7 @@ class ASTNewExpr(ASTExpression):
|
|
|
1428
1439
|
if self.isNewTypeId:
|
|
1429
1440
|
self.typ.describe_signature(signode, mode, env, symbol)
|
|
1430
1441
|
else:
|
|
1431
|
-
raise AssertionError
|
|
1442
|
+
raise AssertionError
|
|
1432
1443
|
if self.initList is not None:
|
|
1433
1444
|
self.initList.describe_signature(signode, mode, env, symbol)
|
|
1434
1445
|
|
|
@@ -1695,12 +1706,12 @@ class ASTOperator(ASTBase):
|
|
|
1695
1706
|
return True
|
|
1696
1707
|
|
|
1697
1708
|
def get_id(self, version: int) -> str:
|
|
1698
|
-
raise NotImplementedError
|
|
1709
|
+
raise NotImplementedError
|
|
1699
1710
|
|
|
1700
1711
|
def _describe_identifier(self, signode: TextElement, identnode: TextElement,
|
|
1701
1712
|
env: BuildEnvironment, symbol: Symbol) -> None:
|
|
1702
1713
|
"""Render the prefix into signode, and the last part into identnode."""
|
|
1703
|
-
raise NotImplementedError
|
|
1714
|
+
raise NotImplementedError
|
|
1704
1715
|
|
|
1705
1716
|
def describe_signature(self, signode: TextElement, mode: str,
|
|
1706
1717
|
env: BuildEnvironment, prefix: str, templateArgs: str,
|
|
@@ -1740,7 +1751,7 @@ class ASTOperatorBuildIn(ASTOperator):
|
|
|
1740
1751
|
if version == 1:
|
|
1741
1752
|
ids = _id_operator_v1
|
|
1742
1753
|
if self.op not in ids:
|
|
1743
|
-
raise NoOldIdError
|
|
1754
|
+
raise NoOldIdError
|
|
1744
1755
|
else:
|
|
1745
1756
|
ids = _id_operator_v2
|
|
1746
1757
|
if self.op not in ids:
|
|
@@ -1768,7 +1779,7 @@ class ASTOperatorLiteral(ASTOperator):
|
|
|
1768
1779
|
|
|
1769
1780
|
def get_id(self, version: int) -> str:
|
|
1770
1781
|
if version == 1:
|
|
1771
|
-
raise NoOldIdError
|
|
1782
|
+
raise NoOldIdError
|
|
1772
1783
|
return 'li' + self.identifier.get_id(version)
|
|
1773
1784
|
|
|
1774
1785
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
@@ -1932,7 +1943,7 @@ class ASTTrailingTypeSpecDecltypeAuto(ASTTrailingTypeSpec):
|
|
|
1932
1943
|
|
|
1933
1944
|
def get_id(self, version: int) -> str:
|
|
1934
1945
|
if version == 1:
|
|
1935
|
-
raise NoOldIdError
|
|
1946
|
+
raise NoOldIdError
|
|
1936
1947
|
return 'Dc'
|
|
1937
1948
|
|
|
1938
1949
|
def describe_signature(self, signode: TextElement, mode: str,
|
|
@@ -1952,7 +1963,7 @@ class ASTTrailingTypeSpecDecltype(ASTTrailingTypeSpec):
|
|
|
1952
1963
|
|
|
1953
1964
|
def get_id(self, version: int) -> str:
|
|
1954
1965
|
if version == 1:
|
|
1955
|
-
raise NoOldIdError
|
|
1966
|
+
raise NoOldIdError
|
|
1956
1967
|
return 'DT' + self.expr.get_id(version) + "E"
|
|
1957
1968
|
|
|
1958
1969
|
def describe_signature(self, signode: TextElement, mode: str,
|
|
@@ -2900,18 +2911,18 @@ class ASTDeclaratorMemPtr(ASTDeclarator):
|
|
|
2900
2911
|
|
|
2901
2912
|
def get_modifiers_id(self, version: int) -> str:
|
|
2902
2913
|
if version == 1:
|
|
2903
|
-
raise NoOldIdError
|
|
2914
|
+
raise NoOldIdError
|
|
2904
2915
|
return self.next.get_modifiers_id(version)
|
|
2905
2916
|
|
|
2906
2917
|
def get_param_id(self, version: int) -> str: # only the parameters (if any)
|
|
2907
2918
|
if version == 1:
|
|
2908
|
-
raise NoOldIdError
|
|
2919
|
+
raise NoOldIdError
|
|
2909
2920
|
return self.next.get_param_id(version)
|
|
2910
2921
|
|
|
2911
2922
|
def get_ptr_suffix_id(self, version: int) -> str:
|
|
2912
2923
|
if version == 1:
|
|
2913
|
-
raise NoOldIdError
|
|
2914
|
-
raise NotImplementedError
|
|
2924
|
+
raise NoOldIdError
|
|
2925
|
+
raise NotImplementedError
|
|
2915
2926
|
return self.next.get_ptr_suffix_id(version) + 'Dp'
|
|
2916
2927
|
|
|
2917
2928
|
def get_type_id(self, version: int, returnTypeId: str) -> str:
|
|
@@ -2996,7 +3007,7 @@ class ASTDeclaratorParen(ASTDeclarator):
|
|
|
2996
3007
|
|
|
2997
3008
|
def get_ptr_suffix_id(self, version: int) -> str:
|
|
2998
3009
|
if version == 1:
|
|
2999
|
-
raise NoOldIdError
|
|
3010
|
+
raise NoOldIdError # TODO: was this implemented before?
|
|
3000
3011
|
return self.next.get_ptr_suffix_id(version) + \
|
|
3001
3012
|
self.inner.get_ptr_suffix_id(version)
|
|
3002
3013
|
return self.inner.get_ptr_suffix_id(version) + \
|
|
@@ -3135,7 +3146,7 @@ class ASTType(ASTBase):
|
|
|
3135
3146
|
raise AssertionError(objectType)
|
|
3136
3147
|
else: # only type encoding
|
|
3137
3148
|
if self.decl.is_function_type():
|
|
3138
|
-
raise NoOldIdError
|
|
3149
|
+
raise NoOldIdError
|
|
3139
3150
|
res.append(self.declSpecs.get_id(version))
|
|
3140
3151
|
res.append(self.decl.get_ptr_suffix_id(version))
|
|
3141
3152
|
res.append(self.decl.get_param_id(version))
|
|
@@ -3286,7 +3297,7 @@ class ASTTypeUsing(ASTBase):
|
|
|
3286
3297
|
def get_id(self, version: int, objectType: str | None = None,
|
|
3287
3298
|
symbol: Symbol | None = None) -> str:
|
|
3288
3299
|
if version == 1:
|
|
3289
|
-
raise NoOldIdError
|
|
3300
|
+
raise NoOldIdError
|
|
3290
3301
|
return symbol.get_full_nested_name().get_id(version)
|
|
3291
3302
|
|
|
3292
3303
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
@@ -3326,7 +3337,7 @@ class ASTConcept(ASTBase):
|
|
|
3326
3337
|
def get_id(self, version: int, objectType: str | None = None,
|
|
3327
3338
|
symbol: Symbol | None = None) -> str:
|
|
3328
3339
|
if version == 1:
|
|
3329
|
-
raise NoOldIdError
|
|
3340
|
+
raise NoOldIdError
|
|
3330
3341
|
return symbol.get_full_nested_name().get_id(version)
|
|
3331
3342
|
|
|
3332
3343
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
@@ -3435,7 +3446,7 @@ class ASTUnion(ASTBase):
|
|
|
3435
3446
|
|
|
3436
3447
|
def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
|
|
3437
3448
|
if version == 1:
|
|
3438
|
-
raise NoOldIdError
|
|
3449
|
+
raise NoOldIdError
|
|
3439
3450
|
return symbol.get_full_nested_name().get_id(version)
|
|
3440
3451
|
|
|
3441
3452
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
@@ -3465,7 +3476,7 @@ class ASTEnum(ASTBase):
|
|
|
3465
3476
|
|
|
3466
3477
|
def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
|
|
3467
3478
|
if version == 1:
|
|
3468
|
-
raise NoOldIdError
|
|
3479
|
+
raise NoOldIdError
|
|
3469
3480
|
return symbol.get_full_nested_name().get_id(version)
|
|
3470
3481
|
|
|
3471
3482
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
@@ -3507,7 +3518,7 @@ class ASTEnumerator(ASTBase):
|
|
|
3507
3518
|
|
|
3508
3519
|
def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
|
|
3509
3520
|
if version == 1:
|
|
3510
|
-
raise NoOldIdError
|
|
3521
|
+
raise NoOldIdError
|
|
3511
3522
|
return symbol.get_full_nested_name().get_id(version)
|
|
3512
3523
|
|
|
3513
3524
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
@@ -4032,7 +4043,7 @@ class ASTDeclaration(ASTBase):
|
|
|
4032
4043
|
def get_id(self, version: int, prefixed: bool = True) -> str:
|
|
4033
4044
|
if version == 1:
|
|
4034
4045
|
if self.templatePrefix or self.trailingRequiresClause:
|
|
4035
|
-
raise NoOldIdError
|
|
4046
|
+
raise NoOldIdError
|
|
4036
4047
|
if self.objectType == 'enumerator' and self.enumeratorScopedSymbol:
|
|
4037
4048
|
return self.enumeratorScopedSymbol.declaration.get_id(version)
|
|
4038
4049
|
return self.declaration.get_id(version, self.objectType, self.symbol)
|
|
@@ -4061,7 +4072,7 @@ class ASTDeclaration(ASTBase):
|
|
|
4061
4072
|
|
|
4062
4073
|
if requiresClauseInLast or self.trailingRequiresClause:
|
|
4063
4074
|
if version < 4:
|
|
4064
|
-
raise NoOldIdError
|
|
4075
|
+
raise NoOldIdError
|
|
4065
4076
|
res.append('IQ')
|
|
4066
4077
|
if requiresClauseInLast and self.trailingRequiresClause:
|
|
4067
4078
|
# make a conjunction of them
|
|
@@ -4221,18 +4232,18 @@ class Symbol:
|
|
|
4221
4232
|
debug_show_tree = False # overridden by the corresponding config value
|
|
4222
4233
|
|
|
4223
4234
|
def __copy__(self):
|
|
4224
|
-
raise AssertionError
|
|
4235
|
+
raise AssertionError # shouldn't happen
|
|
4225
4236
|
|
|
4226
4237
|
def __deepcopy__(self, memo):
|
|
4227
4238
|
if self.parent:
|
|
4228
|
-
raise AssertionError
|
|
4239
|
+
raise AssertionError # shouldn't happen
|
|
4229
4240
|
# the domain base class makes a copy of the initial data, which is fine
|
|
4230
4241
|
return Symbol(None, None, None, None, None, None, None)
|
|
4231
4242
|
|
|
4232
4243
|
@staticmethod
|
|
4233
4244
|
def debug_print(*args: Any) -> None:
|
|
4234
|
-
|
|
4235
|
-
|
|
4245
|
+
logger.debug(Symbol.debug_indent_string * Symbol.debug_indent, end="")
|
|
4246
|
+
logger.debug(*args)
|
|
4236
4247
|
|
|
4237
4248
|
def _assert_invariants(self) -> None:
|
|
4238
4249
|
if not self.parent:
|
|
@@ -4248,7 +4259,7 @@ class Symbol:
|
|
|
4248
4259
|
|
|
4249
4260
|
def __setattr__(self, key: str, value: Any) -> None:
|
|
4250
4261
|
if key == "children":
|
|
4251
|
-
raise AssertionError
|
|
4262
|
+
raise AssertionError
|
|
4252
4263
|
return super().__setattr__(key, value)
|
|
4253
4264
|
|
|
4254
4265
|
def __init__(self, parent: Symbol | None,
|
|
@@ -4441,7 +4452,7 @@ class Symbol:
|
|
|
4441
4452
|
Symbol.debug_print("_find_named_symbols:")
|
|
4442
4453
|
Symbol.debug_indent += 1
|
|
4443
4454
|
Symbol.debug_print("self:")
|
|
4444
|
-
|
|
4455
|
+
logger.debug(self.to_string(Symbol.debug_indent + 1), end="")
|
|
4445
4456
|
Symbol.debug_print("identOrOp: ", identOrOp)
|
|
4446
4457
|
Symbol.debug_print("templateParams: ", templateParams)
|
|
4447
4458
|
Symbol.debug_print("templateArgs: ", templateArgs)
|
|
@@ -4485,7 +4496,7 @@ class Symbol:
|
|
|
4485
4496
|
s = self
|
|
4486
4497
|
if Symbol.debug_lookup:
|
|
4487
4498
|
Symbol.debug_print("searching in self:")
|
|
4488
|
-
|
|
4499
|
+
logger.debug(s.to_string(Symbol.debug_indent + 1), end="")
|
|
4489
4500
|
while True:
|
|
4490
4501
|
if matchSelf:
|
|
4491
4502
|
yield s
|
|
@@ -4499,12 +4510,12 @@ class Symbol:
|
|
|
4499
4510
|
s = s.siblingAbove
|
|
4500
4511
|
if Symbol.debug_lookup:
|
|
4501
4512
|
Symbol.debug_print("searching in sibling:")
|
|
4502
|
-
|
|
4513
|
+
logger.debug(s.to_string(Symbol.debug_indent + 1), end="")
|
|
4503
4514
|
|
|
4504
4515
|
for s in candidates():
|
|
4505
4516
|
if Symbol.debug_lookup:
|
|
4506
4517
|
Symbol.debug_print("candidate:")
|
|
4507
|
-
|
|
4518
|
+
logger.debug(s.to_string(Symbol.debug_indent + 1), end="")
|
|
4508
4519
|
if matches(s):
|
|
4509
4520
|
if Symbol.debug_lookup:
|
|
4510
4521
|
Symbol.debug_indent += 1
|
|
@@ -4534,7 +4545,7 @@ class Symbol:
|
|
|
4534
4545
|
Symbol.debug_print("_symbol_lookup:")
|
|
4535
4546
|
Symbol.debug_indent += 1
|
|
4536
4547
|
Symbol.debug_print("self:")
|
|
4537
|
-
|
|
4548
|
+
logger.debug(self.to_string(Symbol.debug_indent + 1), end="")
|
|
4538
4549
|
Symbol.debug_print("nestedName: ", nestedName)
|
|
4539
4550
|
Symbol.debug_print("templateDecls: ", ",".join(str(t) for t in templateDecls))
|
|
4540
4551
|
Symbol.debug_print("strictTemplateParamArgLists:", strictTemplateParamArgLists)
|
|
@@ -4581,7 +4592,7 @@ class Symbol:
|
|
|
4581
4592
|
|
|
4582
4593
|
if Symbol.debug_lookup:
|
|
4583
4594
|
Symbol.debug_print("starting point:")
|
|
4584
|
-
|
|
4595
|
+
logger.debug(parentSymbol.to_string(Symbol.debug_indent + 1), end="")
|
|
4585
4596
|
|
|
4586
4597
|
# and now the actual lookup
|
|
4587
4598
|
iTemplateDecl = 0
|
|
@@ -4627,7 +4638,7 @@ class Symbol:
|
|
|
4627
4638
|
|
|
4628
4639
|
if Symbol.debug_lookup:
|
|
4629
4640
|
Symbol.debug_print("handle last name from:")
|
|
4630
|
-
|
|
4641
|
+
logger.debug(parentSymbol.to_string(Symbol.debug_indent + 1), end="")
|
|
4631
4642
|
|
|
4632
4643
|
# handle the last name
|
|
4633
4644
|
name = names[-1]
|
|
@@ -4646,7 +4657,7 @@ class Symbol:
|
|
|
4646
4657
|
recurseInAnon=recurseInAnon, correctPrimaryTemplateArgs=False,
|
|
4647
4658
|
searchInSiblings=searchInSiblings)
|
|
4648
4659
|
if Symbol.debug_lookup:
|
|
4649
|
-
symbols = list(symbols) # type: ignore
|
|
4660
|
+
symbols = list(symbols) # type: ignore[assignment]
|
|
4650
4661
|
Symbol.debug_indent -= 2
|
|
4651
4662
|
return SymbolLookupResult(symbols, parentSymbol,
|
|
4652
4663
|
identOrOp, templateParams, templateArgs)
|
|
@@ -4986,14 +4997,14 @@ class Symbol:
|
|
|
4986
4997
|
Symbol.debug_print("matchSelf: ", matchSelf)
|
|
4987
4998
|
Symbol.debug_print("recurseInAnon: ", recurseInAnon)
|
|
4988
4999
|
Symbol.debug_print("searchInSiblings:", searchInSiblings)
|
|
4989
|
-
|
|
5000
|
+
logger.debug(self.to_string(Symbol.debug_indent + 1), end="")
|
|
4990
5001
|
Symbol.debug_indent -= 2
|
|
4991
5002
|
current = self
|
|
4992
5003
|
while current is not None:
|
|
4993
5004
|
if Symbol.debug_lookup:
|
|
4994
5005
|
Symbol.debug_indent += 2
|
|
4995
5006
|
Symbol.debug_print("trying:")
|
|
4996
|
-
|
|
5007
|
+
logger.debug(current.to_string(Symbol.debug_indent + 1), end="")
|
|
4997
5008
|
Symbol.debug_indent -= 2
|
|
4998
5009
|
if matchSelf and current.identOrOp == identOrOp:
|
|
4999
5010
|
return current
|
|
@@ -5036,7 +5047,7 @@ class Symbol:
|
|
|
5036
5047
|
Symbol.debug_print("templateParams:", templateParams)
|
|
5037
5048
|
Symbol.debug_print("id: ", id_)
|
|
5038
5049
|
if s is not None:
|
|
5039
|
-
|
|
5050
|
+
logger.debug(s.to_string(Symbol.debug_indent + 1), end="")
|
|
5040
5051
|
else:
|
|
5041
5052
|
Symbol.debug_print("not found")
|
|
5042
5053
|
if s is None:
|
|
@@ -5058,7 +5069,7 @@ class Symbol:
|
|
|
5058
5069
|
Symbol.debug_print("find_name:")
|
|
5059
5070
|
Symbol.debug_indent += 1
|
|
5060
5071
|
Symbol.debug_print("self:")
|
|
5061
|
-
|
|
5072
|
+
logger.debug(self.to_string(Symbol.debug_indent + 1), end="")
|
|
5062
5073
|
Symbol.debug_print("nestedName: ", nestedName)
|
|
5063
5074
|
Symbol.debug_print("templateDecls: ", templateDecls)
|
|
5064
5075
|
Symbol.debug_print("typ: ", typ)
|
|
@@ -5080,7 +5091,7 @@ class Symbol:
|
|
|
5080
5091
|
# Is there another case where it would be good?
|
|
5081
5092
|
if parentSymbol.declaration is not None:
|
|
5082
5093
|
if parentSymbol.declaration.objectType == 'templateParam':
|
|
5083
|
-
raise QualifiedSymbolIsTemplateParam
|
|
5094
|
+
raise QualifiedSymbolIsTemplateParam
|
|
5084
5095
|
return None
|
|
5085
5096
|
|
|
5086
5097
|
try:
|
|
@@ -6114,7 +6125,8 @@ class DefinitionParser(BaseParser):
|
|
|
6114
6125
|
if modifier is not None:
|
|
6115
6126
|
self.fail(f"Can not have {modifier} without a floating point type.")
|
|
6116
6127
|
else:
|
|
6117
|
-
|
|
6128
|
+
msg = f'Unhandled type {typ}'
|
|
6129
|
+
raise AssertionError(msg)
|
|
6118
6130
|
|
|
6119
6131
|
canonNames: list[str] = []
|
|
6120
6132
|
if modifier is not None:
|
|
@@ -6640,7 +6652,7 @@ class DefinitionParser(BaseParser):
|
|
|
6640
6652
|
elif outer == 'function':
|
|
6641
6653
|
desc = "If the function has no return type"
|
|
6642
6654
|
else:
|
|
6643
|
-
raise AssertionError
|
|
6655
|
+
raise AssertionError from exUntyped
|
|
6644
6656
|
prevErrors.append((exUntyped, desc))
|
|
6645
6657
|
self.pos = startPos
|
|
6646
6658
|
try:
|
|
@@ -6653,7 +6665,7 @@ class DefinitionParser(BaseParser):
|
|
|
6653
6665
|
elif outer == 'function':
|
|
6654
6666
|
desc = "If the function has a return type"
|
|
6655
6667
|
else:
|
|
6656
|
-
raise AssertionError
|
|
6668
|
+
raise AssertionError from exUntyped
|
|
6657
6669
|
prevErrors.append((exTyped, desc))
|
|
6658
6670
|
# Retain the else branch for easier debugging.
|
|
6659
6671
|
# TODO: it would be nice to save the previous stacktrace
|
|
@@ -6665,7 +6677,7 @@ class DefinitionParser(BaseParser):
|
|
|
6665
6677
|
elif outer == 'function':
|
|
6666
6678
|
header = "Error when parsing function declaration."
|
|
6667
6679
|
else:
|
|
6668
|
-
raise AssertionError
|
|
6680
|
+
raise AssertionError from exUntyped
|
|
6669
6681
|
raise self._make_multi_error(prevErrors, header) from exTyped
|
|
6670
6682
|
else: # NoQA: RET506
|
|
6671
6683
|
# For testing purposes.
|
|
@@ -6727,7 +6739,7 @@ class DefinitionParser(BaseParser):
|
|
|
6727
6739
|
return ASTTemplateParamConstrainedTypeWithInit(type, typeInit)
|
|
6728
6740
|
except DefinitionError as eType:
|
|
6729
6741
|
if eExpr is None:
|
|
6730
|
-
raise
|
|
6742
|
+
raise
|
|
6731
6743
|
errs = []
|
|
6732
6744
|
errs.append((eExpr, "If default template argument is an expression"))
|
|
6733
6745
|
errs.append((eType, "If default template argument is a type"))
|
|
@@ -6871,7 +6883,7 @@ class DefinitionParser(BaseParser):
|
|
|
6871
6883
|
(eType, "If unconstrained type parameter or template type parameter"))
|
|
6872
6884
|
errs.append(
|
|
6873
6885
|
(eNonType, "If constrained type parameter or non-type parameter"))
|
|
6874
|
-
raise self._make_multi_error(errs, header)
|
|
6886
|
+
raise self._make_multi_error(errs, header) from None
|
|
6875
6887
|
|
|
6876
6888
|
def _parse_template_parameter_list(self) -> ASTTemplateParams:
|
|
6877
6889
|
# only: '<' parameter-list '>'
|
|
@@ -6904,7 +6916,7 @@ class DefinitionParser(BaseParser):
|
|
|
6904
6916
|
self.fail('Expected "," or ">".')
|
|
6905
6917
|
except DefinitionError as e:
|
|
6906
6918
|
errs.append((e, "If no parameter"))
|
|
6907
|
-
|
|
6919
|
+
logger.debug(errs)
|
|
6908
6920
|
raise self._make_multi_error(errs, header)
|
|
6909
6921
|
|
|
6910
6922
|
def _parse_template_introduction(self) -> ASTTemplateIntroduction:
|
|
@@ -7122,7 +7134,7 @@ class DefinitionParser(BaseParser):
|
|
|
7122
7134
|
elif objectType == 'enumerator':
|
|
7123
7135
|
declaration = self._parse_enumerator()
|
|
7124
7136
|
else:
|
|
7125
|
-
raise AssertionError
|
|
7137
|
+
raise AssertionError
|
|
7126
7138
|
templatePrefix = self._check_template_consistency(declaration.name,
|
|
7127
7139
|
templatePrefix,
|
|
7128
7140
|
fullSpecShorthand=False,
|
|
@@ -7139,7 +7151,7 @@ class DefinitionParser(BaseParser):
|
|
|
7139
7151
|
templatePrefix = self._check_template_consistency(name, templatePrefix,
|
|
7140
7152
|
fullSpecShorthand=False)
|
|
7141
7153
|
res = ASTNamespace(name, templatePrefix)
|
|
7142
|
-
res.objectType = 'namespace' # type: ignore
|
|
7154
|
+
res.objectType = 'namespace' # type: ignore[attr-defined]
|
|
7143
7155
|
return res
|
|
7144
7156
|
|
|
7145
7157
|
def parse_xref_object(self) -> tuple[ASTNamespace | ASTDeclaration, bool]:
|
|
@@ -7154,7 +7166,7 @@ class DefinitionParser(BaseParser):
|
|
|
7154
7166
|
templatePrefix = self._check_template_consistency(name, templatePrefix,
|
|
7155
7167
|
fullSpecShorthand=True)
|
|
7156
7168
|
res1 = ASTNamespace(name, templatePrefix)
|
|
7157
|
-
res1.objectType = 'xref' # type: ignore
|
|
7169
|
+
res1.objectType = 'xref' # type: ignore[attr-defined]
|
|
7158
7170
|
return res1, True
|
|
7159
7171
|
except DefinitionError as e1:
|
|
7160
7172
|
try:
|
|
@@ -7209,6 +7221,9 @@ class CPPObject(ObjectDescription[ASTDeclaration]):
|
|
|
7209
7221
|
]
|
|
7210
7222
|
|
|
7211
7223
|
option_spec: OptionSpec = {
|
|
7224
|
+
'no-index-entry': directives.flag,
|
|
7225
|
+
'no-contents-entry': directives.flag,
|
|
7226
|
+
'no-typesetting': directives.flag,
|
|
7212
7227
|
'noindexentry': directives.flag,
|
|
7213
7228
|
'nocontentsentry': directives.flag,
|
|
7214
7229
|
'tparam-line-spec': directives.flag,
|
|
@@ -7288,7 +7303,7 @@ class CPPObject(ObjectDescription[ASTDeclaration]):
|
|
|
7288
7303
|
if decl.objectType == 'concept':
|
|
7289
7304
|
isInConcept = True
|
|
7290
7305
|
break
|
|
7291
|
-
if not isInConcept and '
|
|
7306
|
+
if not isInConcept and 'no-index-entry' not in self.options:
|
|
7292
7307
|
strippedName = name
|
|
7293
7308
|
for prefix in self.env.config.cpp_index_common_prefix:
|
|
7294
7309
|
if name.startswith(prefix):
|
|
@@ -7315,7 +7330,7 @@ class CPPObject(ObjectDescription[ASTDeclaration]):
|
|
|
7315
7330
|
|
|
7316
7331
|
@property
|
|
7317
7332
|
def object_type(self) -> str:
|
|
7318
|
-
raise NotImplementedError
|
|
7333
|
+
raise NotImplementedError
|
|
7319
7334
|
|
|
7320
7335
|
@property
|
|
7321
7336
|
def display_object_type(self) -> str:
|
|
@@ -7428,10 +7443,38 @@ class CPPObject(ObjectDescription[ASTDeclaration]):
|
|
|
7428
7443
|
self.oldParentKey: LookupKey = self.env.ref_context['cpp:parent_key']
|
|
7429
7444
|
self.env.temp_data['cpp:parent_symbol'] = lastSymbol
|
|
7430
7445
|
self.env.ref_context['cpp:parent_key'] = lastSymbol.get_lookup_key()
|
|
7446
|
+
self.env.temp_data['cpp:domain_name'] = (
|
|
7447
|
+
*self.env.temp_data.get('cpp:domain_name', ()),
|
|
7448
|
+
lastSymbol.identOrOp._stringify(str),
|
|
7449
|
+
)
|
|
7431
7450
|
|
|
7432
7451
|
def after_content(self) -> None:
|
|
7433
7452
|
self.env.temp_data['cpp:parent_symbol'] = self.oldParentSymbol
|
|
7434
7453
|
self.env.ref_context['cpp:parent_key'] = self.oldParentKey
|
|
7454
|
+
self.env.temp_data['cpp:domain_name'] = self.env.temp_data['cpp:domain_name'][:-1]
|
|
7455
|
+
|
|
7456
|
+
def _object_hierarchy_parts(self, sig_node: desc_signature) -> tuple[str, ...]:
|
|
7457
|
+
return tuple(s.identOrOp._stringify(str) for s in
|
|
7458
|
+
self.env.temp_data['cpp:last_symbol'].get_full_nested_name().names)
|
|
7459
|
+
|
|
7460
|
+
def _toc_entry_name(self, sig_node: desc_signature) -> str:
|
|
7461
|
+
if not sig_node.get('_toc_parts'):
|
|
7462
|
+
return ''
|
|
7463
|
+
|
|
7464
|
+
config = self.env.app.config
|
|
7465
|
+
objtype = sig_node.parent.get('objtype')
|
|
7466
|
+
if config.add_function_parentheses and objtype in {'function', 'method'}:
|
|
7467
|
+
parens = '()'
|
|
7468
|
+
else:
|
|
7469
|
+
parens = ''
|
|
7470
|
+
*parents, name = sig_node['_toc_parts']
|
|
7471
|
+
if config.toc_object_entries_show_parents == 'domain':
|
|
7472
|
+
return '::'.join((*self.env.temp_data.get('cpp:domain_name', ()), name + parens))
|
|
7473
|
+
if config.toc_object_entries_show_parents == 'hide':
|
|
7474
|
+
return name + parens
|
|
7475
|
+
if config.toc_object_entries_show_parents == 'all':
|
|
7476
|
+
return '::'.join(parents + [name + parens])
|
|
7477
|
+
return ''
|
|
7435
7478
|
|
|
7436
7479
|
|
|
7437
7480
|
class CPPTypeObject(CPPObject):
|
|
@@ -7632,7 +7675,7 @@ class AliasTransform(SphinxTransform):
|
|
|
7632
7675
|
desc['domain'] = 'cpp'
|
|
7633
7676
|
# 'desctype' is a backwards compatible attribute
|
|
7634
7677
|
desc['objtype'] = desc['desctype'] = 'alias'
|
|
7635
|
-
desc['
|
|
7678
|
+
desc['no-index'] = True
|
|
7636
7679
|
childContainer = desc
|
|
7637
7680
|
|
|
7638
7681
|
for sChild in s._children:
|
|
@@ -7674,9 +7717,9 @@ class AliasTransform(SphinxTransform):
|
|
|
7674
7717
|
rootSymbol: Symbol = self.env.domains['cpp'].data['root_symbol']
|
|
7675
7718
|
parentSymbol: Symbol = rootSymbol.direct_lookup(parentKey)
|
|
7676
7719
|
if not parentSymbol:
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7720
|
+
logger.debug("Target: %s", sig)
|
|
7721
|
+
logger.debug("ParentKey: %s", parentKey)
|
|
7722
|
+
logger.debug(rootSymbol.dump(1))
|
|
7680
7723
|
assert parentSymbol # should be there
|
|
7681
7724
|
|
|
7682
7725
|
symbols: list[Symbol] = []
|
|
@@ -7917,19 +7960,19 @@ class CPPDomain(Domain):
|
|
|
7917
7960
|
|
|
7918
7961
|
def clear_doc(self, docname: str) -> None:
|
|
7919
7962
|
if Symbol.debug_show_tree:
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7963
|
+
logger.debug("clear_doc: %s", docname)
|
|
7964
|
+
logger.debug("\tbefore:")
|
|
7965
|
+
logger.debug(self.data['root_symbol'].dump(1))
|
|
7966
|
+
logger.debug("\tbefore end")
|
|
7924
7967
|
|
|
7925
7968
|
rootSymbol = self.data['root_symbol']
|
|
7926
7969
|
rootSymbol.clear_doc(docname)
|
|
7927
7970
|
|
|
7928
7971
|
if Symbol.debug_show_tree:
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7972
|
+
logger.debug("\tafter:")
|
|
7973
|
+
logger.debug(self.data['root_symbol'].dump(1))
|
|
7974
|
+
logger.debug("\tafter end")
|
|
7975
|
+
logger.debug("clear_doc end: %s", docname)
|
|
7933
7976
|
for name, nDocname in list(self.data['names'].items()):
|
|
7934
7977
|
if nDocname == docname:
|
|
7935
7978
|
del self.data['names'][name]
|
|
@@ -7937,22 +7980,22 @@ class CPPDomain(Domain):
|
|
|
7937
7980
|
def process_doc(self, env: BuildEnvironment, docname: str,
|
|
7938
7981
|
document: nodes.document) -> None:
|
|
7939
7982
|
if Symbol.debug_show_tree:
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7983
|
+
logger.debug("process_doc: %s", docname)
|
|
7984
|
+
logger.debug(self.data['root_symbol'].dump(0))
|
|
7985
|
+
logger.debug("process_doc end: %s", docname)
|
|
7943
7986
|
|
|
7944
7987
|
def process_field_xref(self, pnode: pending_xref) -> None:
|
|
7945
7988
|
pnode.attributes.update(self.env.ref_context)
|
|
7946
7989
|
|
|
7947
7990
|
def merge_domaindata(self, docnames: list[str], otherdata: dict) -> None:
|
|
7948
7991
|
if Symbol.debug_show_tree:
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7992
|
+
logger.debug("merge_domaindata:")
|
|
7993
|
+
logger.debug("\tself:")
|
|
7994
|
+
logger.debug(self.data['root_symbol'].dump(1))
|
|
7995
|
+
logger.debug("\tself end")
|
|
7996
|
+
logger.debug("\tother:")
|
|
7997
|
+
logger.debug(otherdata['root_symbol'].dump(1))
|
|
7998
|
+
logger.debug("\tother end")
|
|
7956
7999
|
|
|
7957
8000
|
self.data['root_symbol'].merge_with(otherdata['root_symbol'],
|
|
7958
8001
|
docnames, self.env)
|
|
@@ -7963,10 +8006,10 @@ class CPPDomain(Domain):
|
|
|
7963
8006
|
ourNames[name] = docname
|
|
7964
8007
|
# no need to warn on duplicates, the symbol merge already does that
|
|
7965
8008
|
if Symbol.debug_show_tree:
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
8009
|
+
logger.debug("\tresult:")
|
|
8010
|
+
logger.debug(self.data['root_symbol'].dump(1))
|
|
8011
|
+
logger.debug("\tresult end")
|
|
8012
|
+
logger.debug("merge_domaindata end")
|
|
7970
8013
|
|
|
7971
8014
|
def _resolve_xref_inner(self, env: BuildEnvironment, fromdocname: str, builder: Builder,
|
|
7972
8015
|
typ: str, target: str, node: pending_xref,
|
|
@@ -8001,9 +8044,9 @@ class CPPDomain(Domain):
|
|
|
8001
8044
|
if parentKey:
|
|
8002
8045
|
parentSymbol: Symbol = rootSymbol.direct_lookup(parentKey)
|
|
8003
8046
|
if not parentSymbol:
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8047
|
+
logger.debug("Target: %s", target)
|
|
8048
|
+
logger.debug("ParentKey: %s", parentKey.data)
|
|
8049
|
+
logger.debug(rootSymbol.dump(1))
|
|
8007
8050
|
assert parentSymbol # should be there
|
|
8008
8051
|
else:
|
|
8009
8052
|
parentSymbol = rootSymbol
|
|
@@ -8056,8 +8099,8 @@ class CPPDomain(Domain):
|
|
|
8056
8099
|
objtypes = self.objtypes_for_role(typ)
|
|
8057
8100
|
if objtypes:
|
|
8058
8101
|
return declTyp in objtypes
|
|
8059
|
-
|
|
8060
|
-
raise AssertionError
|
|
8102
|
+
logger.debug(f"Type is {typ}, declaration type is {declTyp}") # NoQA: G004
|
|
8103
|
+
raise AssertionError
|
|
8061
8104
|
if not checkType():
|
|
8062
8105
|
logger.warning("cpp:%s targets a %s (%s).",
|
|
8063
8106
|
typ, s.declaration.objectType,
|