Sphinx 8.1.2__py3-none-any.whl → 8.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 +8 -4
- sphinx/__main__.py +2 -0
- sphinx/_cli/__init__.py +2 -5
- sphinx/_cli/util/colour.py +34 -11
- sphinx/_cli/util/errors.py +128 -61
- sphinx/addnodes.py +51 -35
- sphinx/application.py +362 -230
- sphinx/builders/__init__.py +87 -64
- sphinx/builders/_epub_base.py +65 -56
- sphinx/builders/changes.py +17 -23
- sphinx/builders/dirhtml.py +8 -13
- sphinx/builders/epub3.py +70 -38
- sphinx/builders/gettext.py +93 -73
- sphinx/builders/html/__init__.py +240 -186
- sphinx/builders/html/_assets.py +9 -2
- sphinx/builders/html/_build_info.py +3 -0
- sphinx/builders/latex/__init__.py +64 -54
- sphinx/builders/latex/constants.py +14 -11
- sphinx/builders/latex/nodes.py +2 -0
- sphinx/builders/latex/theming.py +8 -9
- sphinx/builders/latex/transforms.py +7 -5
- sphinx/builders/linkcheck.py +193 -149
- sphinx/builders/manpage.py +17 -17
- sphinx/builders/singlehtml.py +28 -16
- sphinx/builders/texinfo.py +28 -21
- sphinx/builders/text.py +10 -15
- sphinx/builders/xml.py +10 -19
- sphinx/cmd/build.py +49 -119
- sphinx/cmd/make_mode.py +35 -31
- sphinx/cmd/quickstart.py +78 -62
- sphinx/config.py +265 -163
- sphinx/directives/__init__.py +51 -54
- sphinx/directives/admonitions.py +107 -0
- sphinx/directives/code.py +24 -19
- sphinx/directives/other.py +21 -42
- sphinx/directives/patches.py +28 -16
- sphinx/domains/__init__.py +54 -31
- sphinx/domains/_domains_container.py +22 -17
- sphinx/domains/_index.py +5 -8
- sphinx/domains/c/__init__.py +366 -245
- sphinx/domains/c/_ast.py +378 -256
- sphinx/domains/c/_ids.py +89 -31
- sphinx/domains/c/_parser.py +283 -214
- sphinx/domains/c/_symbol.py +269 -198
- sphinx/domains/changeset.py +39 -24
- sphinx/domains/citation.py +54 -24
- sphinx/domains/cpp/__init__.py +517 -362
- sphinx/domains/cpp/_ast.py +999 -682
- sphinx/domains/cpp/_ids.py +133 -65
- sphinx/domains/cpp/_parser.py +746 -588
- sphinx/domains/cpp/_symbol.py +692 -489
- sphinx/domains/index.py +10 -8
- sphinx/domains/javascript.py +152 -74
- sphinx/domains/math.py +50 -40
- sphinx/domains/python/__init__.py +402 -211
- sphinx/domains/python/_annotations.py +134 -61
- sphinx/domains/python/_object.py +155 -68
- sphinx/domains/rst.py +94 -49
- sphinx/domains/std/__init__.py +510 -249
- sphinx/environment/__init__.py +345 -61
- sphinx/environment/adapters/asset.py +7 -1
- sphinx/environment/adapters/indexentries.py +15 -20
- sphinx/environment/adapters/toctree.py +19 -9
- sphinx/environment/collectors/__init__.py +3 -1
- sphinx/environment/collectors/asset.py +18 -15
- sphinx/environment/collectors/dependencies.py +8 -10
- sphinx/environment/collectors/metadata.py +6 -4
- sphinx/environment/collectors/title.py +3 -1
- sphinx/environment/collectors/toctree.py +4 -4
- sphinx/errors.py +1 -3
- sphinx/events.py +4 -4
- sphinx/ext/apidoc/__init__.py +66 -0
- sphinx/ext/apidoc/__main__.py +9 -0
- sphinx/ext/apidoc/_cli.py +356 -0
- sphinx/ext/apidoc/_extension.py +262 -0
- sphinx/ext/apidoc/_generate.py +356 -0
- sphinx/ext/apidoc/_shared.py +99 -0
- sphinx/ext/autodoc/__init__.py +837 -483
- sphinx/ext/autodoc/directive.py +57 -21
- sphinx/ext/autodoc/importer.py +184 -67
- sphinx/ext/autodoc/mock.py +25 -10
- sphinx/ext/autodoc/preserve_defaults.py +17 -9
- sphinx/ext/autodoc/type_comment.py +56 -29
- sphinx/ext/autodoc/typehints.py +49 -26
- sphinx/ext/autosectionlabel.py +28 -11
- sphinx/ext/autosummary/__init__.py +281 -142
- sphinx/ext/autosummary/generate.py +121 -51
- sphinx/ext/coverage.py +152 -91
- sphinx/ext/doctest.py +169 -101
- sphinx/ext/duration.py +12 -6
- sphinx/ext/extlinks.py +33 -21
- sphinx/ext/githubpages.py +8 -8
- sphinx/ext/graphviz.py +175 -109
- sphinx/ext/ifconfig.py +11 -6
- sphinx/ext/imgconverter.py +48 -25
- sphinx/ext/imgmath.py +127 -97
- sphinx/ext/inheritance_diagram.py +177 -103
- sphinx/ext/intersphinx/__init__.py +22 -13
- sphinx/ext/intersphinx/__main__.py +3 -1
- sphinx/ext/intersphinx/_cli.py +18 -14
- sphinx/ext/intersphinx/_load.py +91 -82
- sphinx/ext/intersphinx/_resolve.py +108 -74
- sphinx/ext/intersphinx/_shared.py +2 -2
- sphinx/ext/linkcode.py +28 -12
- sphinx/ext/mathjax.py +60 -29
- sphinx/ext/napoleon/__init__.py +19 -7
- sphinx/ext/napoleon/docstring.py +229 -231
- sphinx/ext/todo.py +44 -49
- sphinx/ext/viewcode.py +105 -57
- sphinx/extension.py +3 -1
- sphinx/highlighting.py +13 -7
- sphinx/io.py +9 -13
- sphinx/jinja2glue.py +29 -26
- sphinx/locale/__init__.py +8 -9
- sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ar/LC_MESSAGES/sphinx.po +2155 -2050
- sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/bg/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/bn/LC_MESSAGES/sphinx.po +2175 -2070
- sphinx/locale/ca/LC_MESSAGES/sphinx.js +3 -3
- sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ca/LC_MESSAGES/sphinx.po +2690 -2585
- sphinx/locale/ca@valencia/LC_MESSAGES/sphinx.js +63 -0
- sphinx/locale/ca@valencia/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ca@valencia/LC_MESSAGES/sphinx.po +4216 -0
- sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cak/LC_MESSAGES/sphinx.po +2096 -1991
- sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cs/LC_MESSAGES/sphinx.po +2248 -2143
- sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/cy/LC_MESSAGES/sphinx.po +2201 -2096
- sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/da/LC_MESSAGES/sphinx.po +2282 -2177
- sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/de/LC_MESSAGES/sphinx.po +2261 -2156
- sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/el/LC_MESSAGES/sphinx.po +2604 -2499
- sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +2631 -2526
- sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/eo/LC_MESSAGES/sphinx.po +2078 -1973
- sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/es/LC_MESSAGES/sphinx.po +2633 -2528
- sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/et/LC_MESSAGES/sphinx.po +2449 -2344
- sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/eu/LC_MESSAGES/sphinx.po +2241 -2136
- sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fa/LC_MESSAGES/sphinx.po +504 -500
- sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fi/LC_MESSAGES/sphinx.po +499 -495
- sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fr/LC_MESSAGES/sphinx.po +513 -509
- sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +499 -495
- sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/gl/LC_MESSAGES/sphinx.po +2644 -2539
- sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/he/LC_MESSAGES/sphinx.po +499 -495
- sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hi/LC_MESSAGES/sphinx.po +504 -500
- sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +499 -495
- sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hr/LC_MESSAGES/sphinx.po +501 -497
- sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/hu/LC_MESSAGES/sphinx.po +499 -495
- sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/id/LC_MESSAGES/sphinx.po +2609 -2504
- sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/is/LC_MESSAGES/sphinx.po +499 -495
- sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/it/LC_MESSAGES/sphinx.po +2265 -2160
- sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ja/LC_MESSAGES/sphinx.po +2621 -2516
- sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ka/LC_MESSAGES/sphinx.po +2567 -2462
- sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ko/LC_MESSAGES/sphinx.po +2631 -2526
- sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/lt/LC_MESSAGES/sphinx.po +2214 -2109
- sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/lv/LC_MESSAGES/sphinx.po +2218 -2113
- sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/mk/LC_MESSAGES/sphinx.po +2088 -1983
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +2247 -2142
- sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ne/LC_MESSAGES/sphinx.po +2227 -2122
- sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/nl/LC_MESSAGES/sphinx.po +2316 -2211
- sphinx/locale/pl/LC_MESSAGES/sphinx.js +2 -2
- sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pl/LC_MESSAGES/sphinx.po +2442 -2336
- sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +2657 -2552
- sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +2243 -2138
- sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ro/LC_MESSAGES/sphinx.po +2244 -2139
- sphinx/locale/ru/LC_MESSAGES/sphinx.js +1 -1
- sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ru/LC_MESSAGES/sphinx.po +2660 -2555
- sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/si/LC_MESSAGES/sphinx.po +2134 -2029
- sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sk/LC_MESSAGES/sphinx.po +2614 -2509
- sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sl/LC_MESSAGES/sphinx.po +2167 -2062
- sphinx/locale/sphinx.pot +2069 -1964
- sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sq/LC_MESSAGES/sphinx.po +2661 -2556
- sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sr/LC_MESSAGES/sphinx.po +2213 -2108
- sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/sv/LC_MESSAGES/sphinx.po +2229 -2124
- sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/te/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/tr/LC_MESSAGES/sphinx.po +2608 -2503
- sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +2167 -2062
- sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/ur/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/vi/LC_MESSAGES/sphinx.po +2204 -2099
- sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/yue/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +2659 -2554
- sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
- sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +2045 -1940
- sphinx/parsers.py +8 -7
- sphinx/project.py +2 -2
- sphinx/pycode/__init__.py +31 -21
- sphinx/pycode/ast.py +6 -3
- sphinx/pycode/parser.py +14 -8
- sphinx/pygments_styles.py +4 -5
- sphinx/registry.py +192 -92
- sphinx/roles.py +58 -7
- sphinx/search/__init__.py +75 -54
- sphinx/search/en.py +11 -13
- sphinx/search/fi.py +1 -1
- sphinx/search/ja.py +8 -6
- sphinx/search/nl.py +1 -1
- sphinx/search/zh.py +19 -21
- sphinx/testing/fixtures.py +26 -29
- sphinx/testing/path.py +26 -62
- sphinx/testing/restructuredtext.py +14 -8
- sphinx/testing/util.py +21 -19
- sphinx/texinputs/make.bat.jinja +50 -50
- sphinx/texinputs/sphinx.sty +4 -3
- sphinx/texinputs/sphinxlatexadmonitions.sty +1 -1
- sphinx/texinputs/sphinxlatexobjects.sty +29 -10
- sphinx/themes/basic/static/searchtools.js +8 -5
- sphinx/theming.py +49 -61
- sphinx/transforms/__init__.py +17 -38
- sphinx/transforms/compact_bullet_list.py +5 -3
- sphinx/transforms/i18n.py +8 -21
- sphinx/transforms/post_transforms/__init__.py +142 -93
- sphinx/transforms/post_transforms/code.py +5 -5
- sphinx/transforms/post_transforms/images.py +28 -24
- sphinx/transforms/references.py +3 -1
- sphinx/util/__init__.py +109 -60
- sphinx/util/_files.py +39 -23
- sphinx/util/_importer.py +4 -1
- sphinx/util/_inventory_file_reader.py +76 -0
- sphinx/util/_io.py +2 -2
- sphinx/util/_lines.py +6 -3
- sphinx/util/_pathlib.py +40 -2
- sphinx/util/build_phase.py +2 -0
- sphinx/util/cfamily.py +19 -14
- sphinx/util/console.py +44 -179
- sphinx/util/display.py +9 -10
- sphinx/util/docfields.py +140 -122
- sphinx/util/docstrings.py +1 -1
- sphinx/util/docutils.py +118 -77
- sphinx/util/fileutil.py +25 -26
- sphinx/util/http_date.py +2 -0
- sphinx/util/i18n.py +77 -64
- sphinx/util/images.py +8 -6
- sphinx/util/inspect.py +147 -38
- sphinx/util/inventory.py +215 -116
- sphinx/util/logging.py +33 -33
- sphinx/util/matching.py +12 -4
- sphinx/util/nodes.py +18 -13
- sphinx/util/osutil.py +38 -39
- sphinx/util/parallel.py +22 -13
- sphinx/util/parsing.py +2 -1
- sphinx/util/png.py +6 -2
- sphinx/util/requests.py +33 -2
- sphinx/util/rst.py +3 -2
- sphinx/util/tags.py +1 -1
- sphinx/util/template.py +18 -10
- sphinx/util/texescape.py +8 -6
- sphinx/util/typing.py +148 -122
- sphinx/versioning.py +3 -3
- sphinx/writers/html.py +3 -1
- sphinx/writers/html5.py +63 -52
- sphinx/writers/latex.py +83 -67
- sphinx/writers/manpage.py +19 -38
- sphinx/writers/texinfo.py +47 -47
- sphinx/writers/text.py +50 -32
- sphinx/writers/xml.py +11 -8
- {sphinx-8.1.2.dist-info → sphinx-8.2.0.dist-info}/LICENSE.rst +1 -1
- {sphinx-8.1.2.dist-info → sphinx-8.2.0.dist-info}/METADATA +25 -15
- sphinx-8.2.0.dist-info/RECORD +606 -0
- {sphinx-8.1.2.dist-info → sphinx-8.2.0.dist-info}/WHEEL +1 -1
- sphinx/builders/html/transforms.py +0 -90
- sphinx/ext/apidoc.py +0 -721
- sphinx/util/exceptions.py +0 -74
- sphinx-8.1.2.dist-info/RECORD +0 -598
- {sphinx-8.1.2.dist-info → sphinx-8.2.0.dist-info}/entry_points.txt +0 -0
sphinx/domains/cpp/_ast.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
4
|
import warnings
|
|
5
|
-
from typing import TYPE_CHECKING
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
6
|
|
|
7
7
|
from docutils import nodes
|
|
8
8
|
|
|
@@ -20,7 +20,6 @@ from sphinx.domains.cpp._ids import (
|
|
|
20
20
|
_max_id,
|
|
21
21
|
)
|
|
22
22
|
from sphinx.util.cfamily import (
|
|
23
|
-
ASTAttributeList,
|
|
24
23
|
ASTBaseBase,
|
|
25
24
|
ASTBaseParenExprList,
|
|
26
25
|
NoOldIdError,
|
|
@@ -29,12 +28,17 @@ from sphinx.util.cfamily import (
|
|
|
29
28
|
)
|
|
30
29
|
|
|
31
30
|
if TYPE_CHECKING:
|
|
31
|
+
from typing import Any, ClassVar, Literal
|
|
32
|
+
|
|
32
33
|
from docutils.nodes import Element, TextElement
|
|
33
34
|
|
|
34
35
|
from sphinx.addnodes import desc_signature
|
|
35
36
|
from sphinx.domains.cpp._symbol import Symbol
|
|
36
37
|
from sphinx.environment import BuildEnvironment
|
|
37
|
-
from sphinx.util.cfamily import
|
|
38
|
+
from sphinx.util.cfamily import (
|
|
39
|
+
ASTAttributeList,
|
|
40
|
+
StringifyTransform,
|
|
41
|
+
)
|
|
38
42
|
|
|
39
43
|
|
|
40
44
|
class ASTBase(ASTBaseBase):
|
|
@@ -44,6 +48,7 @@ class ASTBase(ASTBaseBase):
|
|
|
44
48
|
# Names
|
|
45
49
|
################################################################################
|
|
46
50
|
|
|
51
|
+
|
|
47
52
|
class ASTIdentifier(ASTBase):
|
|
48
53
|
def __init__(self, name: str) -> None:
|
|
49
54
|
if not isinstance(name, str) or len(name) == 0:
|
|
@@ -75,9 +80,9 @@ class ASTIdentifier(ASTBase):
|
|
|
75
80
|
return 's'
|
|
76
81
|
else:
|
|
77
82
|
return self.name
|
|
78
|
-
if self.name ==
|
|
83
|
+
if self.name == 'std':
|
|
79
84
|
return 'St'
|
|
80
|
-
elif self.name[0] ==
|
|
85
|
+
elif self.name[0] == '~':
|
|
81
86
|
# a destructor, just use an arbitrary version of dtors
|
|
82
87
|
return 'D0'
|
|
83
88
|
else:
|
|
@@ -92,28 +97,39 @@ class ASTIdentifier(ASTBase):
|
|
|
92
97
|
return self.name
|
|
93
98
|
|
|
94
99
|
def get_display_string(self) -> str:
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
def describe_signature(
|
|
98
|
-
|
|
100
|
+
return '[anonymous]' if self.is_anonymous else self.name
|
|
101
|
+
|
|
102
|
+
def describe_signature(
|
|
103
|
+
self,
|
|
104
|
+
signode: TextElement,
|
|
105
|
+
mode: str,
|
|
106
|
+
env: BuildEnvironment,
|
|
107
|
+
prefix: str,
|
|
108
|
+
templateArgs: str,
|
|
109
|
+
symbol: Symbol,
|
|
110
|
+
) -> None:
|
|
99
111
|
verify_description_mode(mode)
|
|
100
112
|
if self.is_anonymous:
|
|
101
|
-
node = addnodes.desc_sig_name(text=
|
|
113
|
+
node = addnodes.desc_sig_name(text='[anonymous]')
|
|
102
114
|
else:
|
|
103
115
|
node = addnodes.desc_sig_name(self.name, self.name)
|
|
104
116
|
if mode == 'markType':
|
|
105
|
-
|
|
106
|
-
pnode = addnodes.pending_xref(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
target_text = prefix + self.name + templateArgs
|
|
118
|
+
pnode = addnodes.pending_xref(
|
|
119
|
+
'',
|
|
120
|
+
refdomain='cpp',
|
|
121
|
+
reftype='identifier',
|
|
122
|
+
reftarget=target_text,
|
|
123
|
+
modname=None,
|
|
124
|
+
classname=None,
|
|
125
|
+
)
|
|
110
126
|
pnode['cpp:parent_key'] = symbol.get_lookup_key()
|
|
111
127
|
pnode += node
|
|
112
128
|
signode += pnode
|
|
113
129
|
elif mode == 'lastIsName':
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
signode +=
|
|
130
|
+
name_node = addnodes.desc_name()
|
|
131
|
+
name_node += node
|
|
132
|
+
signode += name_node
|
|
117
133
|
elif mode == 'noneIsName':
|
|
118
134
|
signode += node
|
|
119
135
|
elif mode == 'param':
|
|
@@ -124,11 +140,15 @@ class ASTIdentifier(ASTBase):
|
|
|
124
140
|
assert len(prefix) == 0
|
|
125
141
|
assert len(templateArgs) == 0
|
|
126
142
|
assert not self.is_anonymous
|
|
127
|
-
|
|
128
|
-
pnode = addnodes.pending_xref(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
143
|
+
target_text = 'operator""' + self.name
|
|
144
|
+
pnode = addnodes.pending_xref(
|
|
145
|
+
'',
|
|
146
|
+
refdomain='cpp',
|
|
147
|
+
reftype='identifier',
|
|
148
|
+
reftarget=target_text,
|
|
149
|
+
modname=None,
|
|
150
|
+
classname=None,
|
|
151
|
+
)
|
|
132
152
|
pnode['cpp:parent_key'] = symbol.get_lookup_key()
|
|
133
153
|
pnode += node
|
|
134
154
|
signode += pnode
|
|
@@ -139,21 +159,28 @@ class ASTIdentifier(ASTBase):
|
|
|
139
159
|
def identifier(self) -> str:
|
|
140
160
|
warnings.warn(
|
|
141
161
|
'`ASTIdentifier.identifier` is deprecated, use `ASTIdentifier.name` instead',
|
|
142
|
-
DeprecationWarning,
|
|
162
|
+
DeprecationWarning,
|
|
163
|
+
stacklevel=2,
|
|
143
164
|
)
|
|
144
165
|
return self.name
|
|
145
166
|
|
|
146
167
|
|
|
147
168
|
class ASTNestedNameElement(ASTBase):
|
|
148
|
-
def __init__(
|
|
149
|
-
|
|
169
|
+
def __init__(
|
|
170
|
+
self,
|
|
171
|
+
identOrOp: ASTIdentifier | ASTOperator,
|
|
172
|
+
templateArgs: ASTTemplateArgs | None,
|
|
173
|
+
) -> None:
|
|
150
174
|
self.identOrOp = identOrOp
|
|
151
175
|
self.templateArgs = templateArgs
|
|
152
176
|
|
|
153
177
|
def __eq__(self, other: object) -> bool:
|
|
154
178
|
if not isinstance(other, ASTNestedNameElement):
|
|
155
179
|
return NotImplemented
|
|
156
|
-
return
|
|
180
|
+
return (
|
|
181
|
+
self.identOrOp == other.identOrOp
|
|
182
|
+
and self.templateArgs == other.templateArgs
|
|
183
|
+
)
|
|
157
184
|
|
|
158
185
|
def __hash__(self) -> int:
|
|
159
186
|
return hash((self.identOrOp, self.templateArgs))
|
|
@@ -173,17 +200,24 @@ class ASTNestedNameElement(ASTBase):
|
|
|
173
200
|
res += transform(self.templateArgs)
|
|
174
201
|
return res
|
|
175
202
|
|
|
176
|
-
def describe_signature(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
203
|
+
def describe_signature(
|
|
204
|
+
self,
|
|
205
|
+
signode: TextElement,
|
|
206
|
+
mode: str,
|
|
207
|
+
env: BuildEnvironment,
|
|
208
|
+
prefix: str,
|
|
209
|
+
symbol: Symbol,
|
|
210
|
+
) -> None:
|
|
211
|
+
t_args = str(self.templateArgs) if self.templateArgs is not None else ''
|
|
212
|
+
self.identOrOp.describe_signature(signode, mode, env, prefix, t_args, symbol)
|
|
180
213
|
if self.templateArgs is not None:
|
|
181
214
|
self.templateArgs.describe_signature(signode, 'markType', env, symbol)
|
|
182
215
|
|
|
183
216
|
|
|
184
217
|
class ASTNestedName(ASTBase):
|
|
185
|
-
def __init__(
|
|
186
|
-
|
|
218
|
+
def __init__(
|
|
219
|
+
self, names: list[ASTNestedNameElement], templates: list[bool], rooted: bool
|
|
220
|
+
) -> None:
|
|
187
221
|
assert len(names) > 0
|
|
188
222
|
self.names = names
|
|
189
223
|
self.templates = templates
|
|
@@ -239,49 +273,50 @@ class ASTNestedName(ASTBase):
|
|
|
239
273
|
for i in range(len(self.names)):
|
|
240
274
|
n = self.names[i]
|
|
241
275
|
if self.templates[i]:
|
|
242
|
-
res.append(
|
|
276
|
+
res.append('template ' + transform(n))
|
|
243
277
|
else:
|
|
244
278
|
res.append(transform(n))
|
|
245
279
|
return '::'.join(res)
|
|
246
280
|
|
|
247
|
-
def describe_signature(
|
|
248
|
-
|
|
281
|
+
def describe_signature(
|
|
282
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
283
|
+
) -> None:
|
|
249
284
|
verify_description_mode(mode)
|
|
250
285
|
# just print the name part, with template args, not template params
|
|
251
286
|
if mode == 'noneIsName':
|
|
252
287
|
if self.rooted:
|
|
253
|
-
unreachable =
|
|
254
|
-
raise AssertionError(unreachable) # TODO
|
|
288
|
+
unreachable = 'Can this happen?'
|
|
289
|
+
raise AssertionError(unreachable) # TODO: Can this happen?
|
|
255
290
|
signode += nodes.Text('::')
|
|
256
291
|
for i in range(len(self.names)):
|
|
257
292
|
if i != 0:
|
|
258
|
-
unreachable =
|
|
259
|
-
raise AssertionError(unreachable) # TODO
|
|
293
|
+
unreachable = 'Can this happen?'
|
|
294
|
+
raise AssertionError(unreachable) # TODO: Can this happen?
|
|
260
295
|
signode += nodes.Text('::blah')
|
|
261
296
|
n = self.names[i]
|
|
262
297
|
if self.templates[i]:
|
|
263
|
-
unreachable =
|
|
264
|
-
raise AssertionError(unreachable) # TODO
|
|
265
|
-
signode += nodes.Text(
|
|
266
|
-
signode += nodes.Text(
|
|
298
|
+
unreachable = 'Can this happen?'
|
|
299
|
+
raise AssertionError(unreachable) # TODO: Can this happen?
|
|
300
|
+
signode += nodes.Text('template')
|
|
301
|
+
signode += nodes.Text(' ')
|
|
267
302
|
n.describe_signature(signode, mode, env, '', symbol)
|
|
268
303
|
elif mode == 'param':
|
|
269
304
|
assert not self.rooted, str(self)
|
|
270
305
|
assert len(self.names) == 1
|
|
271
306
|
assert not self.templates[0]
|
|
272
307
|
self.names[0].describe_signature(signode, 'param', env, '', symbol)
|
|
273
|
-
elif mode in
|
|
308
|
+
elif mode in {'markType', 'lastIsName', 'markName'}:
|
|
274
309
|
# Each element should be a pending xref targeting the complete
|
|
275
310
|
# prefix. however, only the identifier part should be a link, such
|
|
276
311
|
# that template args can be a link as well.
|
|
277
312
|
# For 'lastIsName' we should also prepend template parameter lists.
|
|
278
|
-
|
|
313
|
+
template_params: list[Any] = []
|
|
279
314
|
if mode == 'lastIsName':
|
|
280
315
|
assert symbol is not None
|
|
281
316
|
if symbol.declaration.templatePrefix is not None:
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
317
|
+
template_params = symbol.declaration.templatePrefix.templates
|
|
318
|
+
i_template_params = 0
|
|
319
|
+
template_params_prefix = ''
|
|
285
320
|
prefix = ''
|
|
286
321
|
first = True
|
|
287
322
|
names = self.names[:-1] if mode == 'lastIsName' else self.names
|
|
@@ -309,12 +344,15 @@ class ASTNestedName(ASTBase):
|
|
|
309
344
|
dest += addnodes.desc_sig_space()
|
|
310
345
|
first = False
|
|
311
346
|
txt_nne = str(nne)
|
|
312
|
-
if txt_nne
|
|
313
|
-
if nne.templateArgs and
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
347
|
+
if txt_nne:
|
|
348
|
+
if nne.templateArgs and i_template_params < len(template_params):
|
|
349
|
+
template_params_prefix += str(
|
|
350
|
+
template_params[i_template_params]
|
|
351
|
+
)
|
|
352
|
+
i_template_params += 1
|
|
353
|
+
nne.describe_signature(
|
|
354
|
+
dest, 'markType', env, template_params_prefix + prefix, symbol
|
|
355
|
+
)
|
|
318
356
|
prefix += txt_nne
|
|
319
357
|
if mode == 'lastIsName':
|
|
320
358
|
if len(self.names) > 1:
|
|
@@ -332,18 +370,21 @@ class ASTNestedName(ASTBase):
|
|
|
332
370
|
# Expressions
|
|
333
371
|
################################################################################
|
|
334
372
|
|
|
373
|
+
|
|
335
374
|
class ASTExpression(ASTBase):
|
|
336
375
|
def get_id(self, version: int) -> str:
|
|
337
376
|
raise NotImplementedError(repr(self))
|
|
338
377
|
|
|
339
|
-
def describe_signature(
|
|
340
|
-
|
|
378
|
+
def describe_signature(
|
|
379
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
380
|
+
) -> None:
|
|
341
381
|
raise NotImplementedError(repr(self))
|
|
342
382
|
|
|
343
383
|
|
|
344
384
|
# Primary expressions
|
|
345
385
|
################################################################################
|
|
346
386
|
|
|
387
|
+
|
|
347
388
|
class ASTLiteral(ASTExpression):
|
|
348
389
|
pass
|
|
349
390
|
|
|
@@ -361,8 +402,9 @@ class ASTPointerLiteral(ASTLiteral):
|
|
|
361
402
|
def get_id(self, version: int) -> str:
|
|
362
403
|
return 'LDnE'
|
|
363
404
|
|
|
364
|
-
def describe_signature(
|
|
365
|
-
|
|
405
|
+
def describe_signature(
|
|
406
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
407
|
+
) -> None:
|
|
366
408
|
signode += addnodes.desc_sig_keyword('nullptr', 'nullptr')
|
|
367
409
|
|
|
368
410
|
|
|
@@ -390,8 +432,9 @@ class ASTBooleanLiteral(ASTLiteral):
|
|
|
390
432
|
else:
|
|
391
433
|
return 'L0E'
|
|
392
434
|
|
|
393
|
-
def describe_signature(
|
|
394
|
-
|
|
435
|
+
def describe_signature(
|
|
436
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
437
|
+
) -> None:
|
|
395
438
|
signode += addnodes.desc_sig_keyword(str(self), str(self))
|
|
396
439
|
|
|
397
440
|
|
|
@@ -412,10 +455,11 @@ class ASTNumberLiteral(ASTLiteral):
|
|
|
412
455
|
|
|
413
456
|
def get_id(self, version: int) -> str:
|
|
414
457
|
# TODO: floats should be mangled by writing the hex of the binary representation
|
|
415
|
-
return
|
|
458
|
+
return 'L%sE' % self.data.replace("'", '')
|
|
416
459
|
|
|
417
|
-
def describe_signature(
|
|
418
|
-
|
|
460
|
+
def describe_signature(
|
|
461
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
462
|
+
) -> None:
|
|
419
463
|
signode += addnodes.desc_sig_literal_number(self.data, self.data)
|
|
420
464
|
|
|
421
465
|
|
|
@@ -436,10 +480,11 @@ class ASTStringLiteral(ASTLiteral):
|
|
|
436
480
|
|
|
437
481
|
def get_id(self, version: int) -> str:
|
|
438
482
|
# note: the length is not really correct with escaping
|
|
439
|
-
return
|
|
483
|
+
return 'LA%d_KcE' % (len(self.data) - 2)
|
|
440
484
|
|
|
441
|
-
def describe_signature(
|
|
442
|
-
|
|
485
|
+
def describe_signature(
|
|
486
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
487
|
+
) -> None:
|
|
443
488
|
signode += addnodes.desc_sig_literal_string(self.data, self.data)
|
|
444
489
|
|
|
445
490
|
|
|
@@ -458,10 +503,7 @@ class ASTCharLiteral(ASTLiteral):
|
|
|
458
503
|
def __eq__(self, other: object) -> bool:
|
|
459
504
|
if not isinstance(other, ASTCharLiteral):
|
|
460
505
|
return NotImplemented
|
|
461
|
-
return
|
|
462
|
-
self.prefix == other.prefix
|
|
463
|
-
and self.value == other.value
|
|
464
|
-
)
|
|
506
|
+
return self.prefix == other.prefix and self.value == other.value
|
|
465
507
|
|
|
466
508
|
def __hash__(self) -> int:
|
|
467
509
|
return hash((self.prefix, self.value))
|
|
@@ -476,8 +518,9 @@ class ASTCharLiteral(ASTLiteral):
|
|
|
476
518
|
# TODO: the ID should be have L E around it
|
|
477
519
|
return self.type + str(self.value)
|
|
478
520
|
|
|
479
|
-
def describe_signature(
|
|
480
|
-
|
|
521
|
+
def describe_signature(
|
|
522
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
523
|
+
) -> None:
|
|
481
524
|
if self.prefix is not None:
|
|
482
525
|
signode += addnodes.desc_sig_keyword(self.prefix, self.prefix)
|
|
483
526
|
txt = "'" + self.data + "'"
|
|
@@ -504,35 +547,39 @@ class ASTUserDefinedLiteral(ASTLiteral):
|
|
|
504
547
|
# mangle as if it was a function call: ident(literal)
|
|
505
548
|
return f'clL_Zli{self.ident.get_id(version)}E{self.literal.get_id(version)}E'
|
|
506
549
|
|
|
507
|
-
def describe_signature(
|
|
508
|
-
|
|
550
|
+
def describe_signature(
|
|
551
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
552
|
+
) -> None:
|
|
509
553
|
self.literal.describe_signature(signode, mode, env, symbol)
|
|
510
|
-
self.ident.describe_signature(signode,
|
|
554
|
+
self.ident.describe_signature(signode, 'udl', env, '', '', symbol)
|
|
511
555
|
|
|
512
556
|
|
|
513
557
|
################################################################################
|
|
514
558
|
|
|
559
|
+
|
|
515
560
|
class ASTThisLiteral(ASTExpression):
|
|
516
561
|
def __eq__(self, other: object) -> bool:
|
|
517
562
|
return isinstance(other, ASTThisLiteral)
|
|
518
563
|
|
|
519
564
|
def __hash__(self) -> int:
|
|
520
|
-
return hash(
|
|
565
|
+
return hash('this')
|
|
521
566
|
|
|
522
567
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
523
|
-
return
|
|
568
|
+
return 'this'
|
|
524
569
|
|
|
525
570
|
def get_id(self, version: int) -> str:
|
|
526
|
-
return
|
|
571
|
+
return 'fpT'
|
|
527
572
|
|
|
528
|
-
def describe_signature(
|
|
529
|
-
|
|
573
|
+
def describe_signature(
|
|
574
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
575
|
+
) -> None:
|
|
530
576
|
signode += addnodes.desc_sig_keyword('this', 'this')
|
|
531
577
|
|
|
532
578
|
|
|
533
579
|
class ASTFoldExpr(ASTExpression):
|
|
534
|
-
def __init__(
|
|
535
|
-
|
|
580
|
+
def __init__(
|
|
581
|
+
self, leftExpr: ASTExpression | None, op: str, rightExpr: ASTExpression | None
|
|
582
|
+
) -> None:
|
|
536
583
|
assert leftExpr is not None or rightExpr is not None
|
|
537
584
|
self.leftExpr = leftExpr
|
|
538
585
|
self.op = op
|
|
@@ -553,16 +600,20 @@ class ASTFoldExpr(ASTExpression):
|
|
|
553
600
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
554
601
|
res = ['(']
|
|
555
602
|
if self.leftExpr:
|
|
556
|
-
res.
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
603
|
+
res.extend((
|
|
604
|
+
transform(self.leftExpr),
|
|
605
|
+
' ',
|
|
606
|
+
self.op,
|
|
607
|
+
' ',
|
|
608
|
+
))
|
|
560
609
|
res.append('...')
|
|
561
610
|
if self.rightExpr:
|
|
562
|
-
res.
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
611
|
+
res.extend((
|
|
612
|
+
' ',
|
|
613
|
+
self.op,
|
|
614
|
+
' ',
|
|
615
|
+
transform(self.rightExpr),
|
|
616
|
+
))
|
|
566
617
|
res.append(')')
|
|
567
618
|
return ''.join(res)
|
|
568
619
|
|
|
@@ -587,8 +638,9 @@ class ASTFoldExpr(ASTExpression):
|
|
|
587
638
|
res.append(self.rightExpr.get_id(version))
|
|
588
639
|
return ''.join(res)
|
|
589
640
|
|
|
590
|
-
def describe_signature(
|
|
591
|
-
|
|
641
|
+
def describe_signature(
|
|
642
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
643
|
+
) -> None:
|
|
592
644
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
593
645
|
if self.leftExpr:
|
|
594
646
|
self.leftExpr.describe_signature(signode, mode, env, symbol)
|
|
@@ -622,8 +674,9 @@ class ASTParenExpr(ASTExpression):
|
|
|
622
674
|
def get_id(self, version: int) -> str:
|
|
623
675
|
return self.expr.get_id(version)
|
|
624
676
|
|
|
625
|
-
def describe_signature(
|
|
626
|
-
|
|
677
|
+
def describe_signature(
|
|
678
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
679
|
+
) -> None:
|
|
627
680
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
628
681
|
self.expr.describe_signature(signode, mode, env, symbol)
|
|
629
682
|
signode += addnodes.desc_sig_punctuation(')', ')')
|
|
@@ -648,20 +701,23 @@ class ASTIdExpression(ASTExpression):
|
|
|
648
701
|
def get_id(self, version: int) -> str:
|
|
649
702
|
return self.name.get_id(version)
|
|
650
703
|
|
|
651
|
-
def describe_signature(
|
|
652
|
-
|
|
704
|
+
def describe_signature(
|
|
705
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
706
|
+
) -> None:
|
|
653
707
|
self.name.describe_signature(signode, mode, env, symbol)
|
|
654
708
|
|
|
655
709
|
|
|
656
710
|
# Postfix expressions
|
|
657
711
|
################################################################################
|
|
658
712
|
|
|
713
|
+
|
|
659
714
|
class ASTPostfixOp(ASTBase):
|
|
660
715
|
def get_id(self, idPrefix: str, version: int) -> str:
|
|
661
716
|
raise NotImplementedError(repr(self))
|
|
662
717
|
|
|
663
|
-
def describe_signature(
|
|
664
|
-
|
|
718
|
+
def describe_signature(
|
|
719
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
720
|
+
) -> None:
|
|
665
721
|
raise NotImplementedError(repr(self))
|
|
666
722
|
|
|
667
723
|
|
|
@@ -683,8 +739,9 @@ class ASTPostfixArray(ASTPostfixOp):
|
|
|
683
739
|
def get_id(self, idPrefix: str, version: int) -> str:
|
|
684
740
|
return 'ix' + idPrefix + self.expr.get_id(version)
|
|
685
741
|
|
|
686
|
-
def describe_signature(
|
|
687
|
-
|
|
742
|
+
def describe_signature(
|
|
743
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
744
|
+
) -> None:
|
|
688
745
|
signode += addnodes.desc_sig_punctuation('[', '[')
|
|
689
746
|
self.expr.describe_signature(signode, mode, env, symbol)
|
|
690
747
|
signode += addnodes.desc_sig_punctuation(']', ']')
|
|
@@ -708,8 +765,9 @@ class ASTPostfixMember(ASTPostfixOp):
|
|
|
708
765
|
def get_id(self, idPrefix: str, version: int) -> str:
|
|
709
766
|
return 'dt' + idPrefix + self.name.get_id(version)
|
|
710
767
|
|
|
711
|
-
def describe_signature(
|
|
712
|
-
|
|
768
|
+
def describe_signature(
|
|
769
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
770
|
+
) -> None:
|
|
713
771
|
signode += addnodes.desc_sig_punctuation('.', '.')
|
|
714
772
|
self.name.describe_signature(signode, 'noneIsName', env, symbol)
|
|
715
773
|
|
|
@@ -732,8 +790,9 @@ class ASTPostfixMemberOfPointer(ASTPostfixOp):
|
|
|
732
790
|
def get_id(self, idPrefix: str, version: int) -> str:
|
|
733
791
|
return 'pt' + idPrefix + self.name.get_id(version)
|
|
734
792
|
|
|
735
|
-
def describe_signature(
|
|
736
|
-
|
|
793
|
+
def describe_signature(
|
|
794
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
795
|
+
) -> None:
|
|
737
796
|
signode += addnodes.desc_sig_operator('->', '->')
|
|
738
797
|
self.name.describe_signature(signode, 'noneIsName', env, symbol)
|
|
739
798
|
|
|
@@ -751,8 +810,9 @@ class ASTPostfixInc(ASTPostfixOp):
|
|
|
751
810
|
def get_id(self, idPrefix: str, version: int) -> str:
|
|
752
811
|
return 'pp' + idPrefix
|
|
753
812
|
|
|
754
|
-
def describe_signature(
|
|
755
|
-
|
|
813
|
+
def describe_signature(
|
|
814
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
815
|
+
) -> None:
|
|
756
816
|
signode += addnodes.desc_sig_operator('++', '++')
|
|
757
817
|
|
|
758
818
|
|
|
@@ -769,8 +829,9 @@ class ASTPostfixDec(ASTPostfixOp):
|
|
|
769
829
|
def get_id(self, idPrefix: str, version: int) -> str:
|
|
770
830
|
return 'mm' + idPrefix
|
|
771
831
|
|
|
772
|
-
def describe_signature(
|
|
773
|
-
|
|
832
|
+
def describe_signature(
|
|
833
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
834
|
+
) -> None:
|
|
774
835
|
signode += addnodes.desc_sig_operator('--', '--')
|
|
775
836
|
|
|
776
837
|
|
|
@@ -797,8 +858,9 @@ class ASTPostfixCallExpr(ASTPostfixOp):
|
|
|
797
858
|
'E',
|
|
798
859
|
])
|
|
799
860
|
|
|
800
|
-
def describe_signature(
|
|
801
|
-
|
|
861
|
+
def describe_signature(
|
|
862
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
863
|
+
) -> None:
|
|
802
864
|
self.lst.describe_signature(signode, mode, env, symbol)
|
|
803
865
|
|
|
804
866
|
|
|
@@ -816,7 +878,10 @@ class ASTPostfixExpr(ASTExpression):
|
|
|
816
878
|
return hash((self.prefix, self.postFixes))
|
|
817
879
|
|
|
818
880
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
819
|
-
return ''.join([
|
|
881
|
+
return ''.join([
|
|
882
|
+
transform(self.prefix),
|
|
883
|
+
*(transform(p) for p in self.postFixes),
|
|
884
|
+
])
|
|
820
885
|
|
|
821
886
|
def get_id(self, version: int) -> str:
|
|
822
887
|
id = self.prefix.get_id(version)
|
|
@@ -824,8 +889,9 @@ class ASTPostfixExpr(ASTExpression):
|
|
|
824
889
|
id = p.get_id(id, version)
|
|
825
890
|
return id
|
|
826
891
|
|
|
827
|
-
def describe_signature(
|
|
828
|
-
|
|
892
|
+
def describe_signature(
|
|
893
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
894
|
+
) -> None:
|
|
829
895
|
self.prefix.describe_signature(signode, mode, env, symbol)
|
|
830
896
|
for p in self.postFixes:
|
|
831
897
|
p.describe_signature(signode, mode, env, symbol)
|
|
@@ -841,27 +907,36 @@ class ASTExplicitCast(ASTExpression):
|
|
|
841
907
|
def __eq__(self, other: object) -> bool:
|
|
842
908
|
if not isinstance(other, ASTExplicitCast):
|
|
843
909
|
return NotImplemented
|
|
844
|
-
return
|
|
910
|
+
return (
|
|
911
|
+
self.cast == other.cast
|
|
912
|
+
and self.typ == other.typ
|
|
913
|
+
and self.expr == other.expr
|
|
914
|
+
)
|
|
845
915
|
|
|
846
916
|
def __hash__(self) -> int:
|
|
847
917
|
return hash((self.cast, self.typ, self.expr))
|
|
848
918
|
|
|
849
919
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
850
920
|
res = [self.cast]
|
|
851
|
-
res.
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
921
|
+
res.extend((
|
|
922
|
+
'<',
|
|
923
|
+
transform(self.typ),
|
|
924
|
+
'>(',
|
|
925
|
+
transform(self.expr),
|
|
926
|
+
')',
|
|
927
|
+
))
|
|
856
928
|
return ''.join(res)
|
|
857
929
|
|
|
858
930
|
def get_id(self, version: int) -> str:
|
|
859
|
-
return (
|
|
860
|
-
|
|
861
|
-
|
|
931
|
+
return (
|
|
932
|
+
_id_explicit_cast[self.cast]
|
|
933
|
+
+ self.typ.get_id(version)
|
|
934
|
+
+ self.expr.get_id(version)
|
|
935
|
+
)
|
|
862
936
|
|
|
863
|
-
def describe_signature(
|
|
864
|
-
|
|
937
|
+
def describe_signature(
|
|
938
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
939
|
+
) -> None:
|
|
865
940
|
signode += addnodes.desc_sig_keyword(self.cast, self.cast)
|
|
866
941
|
signode += addnodes.desc_sig_punctuation('<', '<')
|
|
867
942
|
self.typ.describe_signature(signode, mode, env, symbol)
|
|
@@ -891,8 +966,9 @@ class ASTTypeId(ASTExpression):
|
|
|
891
966
|
prefix = 'ti' if self.isType else 'te'
|
|
892
967
|
return prefix + self.typeOrExpr.get_id(version)
|
|
893
968
|
|
|
894
|
-
def describe_signature(
|
|
895
|
-
|
|
969
|
+
def describe_signature(
|
|
970
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
971
|
+
) -> None:
|
|
896
972
|
signode += addnodes.desc_sig_keyword('typeid', 'typeid')
|
|
897
973
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
898
974
|
self.typeOrExpr.describe_signature(signode, mode, env, symbol)
|
|
@@ -902,6 +978,7 @@ class ASTTypeId(ASTExpression):
|
|
|
902
978
|
# Unary expressions
|
|
903
979
|
################################################################################
|
|
904
980
|
|
|
981
|
+
|
|
905
982
|
class ASTUnaryOpExpr(ASTExpression):
|
|
906
983
|
def __init__(self, op: str, expr: ASTExpression) -> None:
|
|
907
984
|
self.op = op
|
|
@@ -917,15 +994,16 @@ class ASTUnaryOpExpr(ASTExpression):
|
|
|
917
994
|
|
|
918
995
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
919
996
|
if self.op[0] in 'cn':
|
|
920
|
-
return self.op +
|
|
997
|
+
return self.op + ' ' + transform(self.expr)
|
|
921
998
|
else:
|
|
922
999
|
return self.op + transform(self.expr)
|
|
923
1000
|
|
|
924
1001
|
def get_id(self, version: int) -> str:
|
|
925
1002
|
return _id_operator_unary_v2[self.op] + self.expr.get_id(version)
|
|
926
1003
|
|
|
927
|
-
def describe_signature(
|
|
928
|
-
|
|
1004
|
+
def describe_signature(
|
|
1005
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1006
|
+
) -> None:
|
|
929
1007
|
if self.op[0] in 'cn':
|
|
930
1008
|
signode += addnodes.desc_sig_keyword(self.op, self.op)
|
|
931
1009
|
signode += addnodes.desc_sig_space()
|
|
@@ -947,18 +1025,20 @@ class ASTSizeofParamPack(ASTExpression):
|
|
|
947
1025
|
return hash(self.identifier)
|
|
948
1026
|
|
|
949
1027
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
950
|
-
return
|
|
1028
|
+
return 'sizeof...(' + transform(self.identifier) + ')'
|
|
951
1029
|
|
|
952
1030
|
def get_id(self, version: int) -> str:
|
|
953
1031
|
return 'sZ' + self.identifier.get_id(version)
|
|
954
1032
|
|
|
955
|
-
def describe_signature(
|
|
956
|
-
|
|
1033
|
+
def describe_signature(
|
|
1034
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1035
|
+
) -> None:
|
|
957
1036
|
signode += addnodes.desc_sig_keyword('sizeof', 'sizeof')
|
|
958
1037
|
signode += addnodes.desc_sig_punctuation('...', '...')
|
|
959
1038
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
960
|
-
self.identifier.describe_signature(
|
|
961
|
-
|
|
1039
|
+
self.identifier.describe_signature(
|
|
1040
|
+
signode, 'markType', env, symbol=symbol, prefix='', templateArgs=''
|
|
1041
|
+
)
|
|
962
1042
|
signode += addnodes.desc_sig_punctuation(')', ')')
|
|
963
1043
|
|
|
964
1044
|
|
|
@@ -975,13 +1055,14 @@ class ASTSizeofType(ASTExpression):
|
|
|
975
1055
|
return hash(self.typ)
|
|
976
1056
|
|
|
977
1057
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
978
|
-
return
|
|
1058
|
+
return 'sizeof(' + transform(self.typ) + ')'
|
|
979
1059
|
|
|
980
1060
|
def get_id(self, version: int) -> str:
|
|
981
1061
|
return 'st' + self.typ.get_id(version)
|
|
982
1062
|
|
|
983
|
-
def describe_signature(
|
|
984
|
-
|
|
1063
|
+
def describe_signature(
|
|
1064
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1065
|
+
) -> None:
|
|
985
1066
|
signode += addnodes.desc_sig_keyword('sizeof', 'sizeof')
|
|
986
1067
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
987
1068
|
self.typ.describe_signature(signode, mode, env, symbol)
|
|
@@ -1001,13 +1082,14 @@ class ASTSizeofExpr(ASTExpression):
|
|
|
1001
1082
|
return hash(self.expr)
|
|
1002
1083
|
|
|
1003
1084
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
1004
|
-
return
|
|
1085
|
+
return 'sizeof ' + transform(self.expr)
|
|
1005
1086
|
|
|
1006
1087
|
def get_id(self, version: int) -> str:
|
|
1007
1088
|
return 'sz' + self.expr.get_id(version)
|
|
1008
1089
|
|
|
1009
|
-
def describe_signature(
|
|
1010
|
-
|
|
1090
|
+
def describe_signature(
|
|
1091
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1092
|
+
) -> None:
|
|
1011
1093
|
signode += addnodes.desc_sig_keyword('sizeof', 'sizeof')
|
|
1012
1094
|
signode += addnodes.desc_sig_space()
|
|
1013
1095
|
self.expr.describe_signature(signode, mode, env, symbol)
|
|
@@ -1026,13 +1108,14 @@ class ASTAlignofExpr(ASTExpression):
|
|
|
1026
1108
|
return hash(self.typ)
|
|
1027
1109
|
|
|
1028
1110
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
1029
|
-
return
|
|
1111
|
+
return 'alignof(' + transform(self.typ) + ')'
|
|
1030
1112
|
|
|
1031
1113
|
def get_id(self, version: int) -> str:
|
|
1032
1114
|
return 'at' + self.typ.get_id(version)
|
|
1033
1115
|
|
|
1034
|
-
def describe_signature(
|
|
1035
|
-
|
|
1116
|
+
def describe_signature(
|
|
1117
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1118
|
+
) -> None:
|
|
1036
1119
|
signode += addnodes.desc_sig_keyword('alignof', 'alignof')
|
|
1037
1120
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
1038
1121
|
self.typ.describe_signature(signode, mode, env, symbol)
|
|
@@ -1057,8 +1140,9 @@ class ASTNoexceptExpr(ASTExpression):
|
|
|
1057
1140
|
def get_id(self, version: int) -> str:
|
|
1058
1141
|
return 'nx' + self.expr.get_id(version)
|
|
1059
1142
|
|
|
1060
|
-
def describe_signature(
|
|
1061
|
-
|
|
1143
|
+
def describe_signature(
|
|
1144
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1145
|
+
) -> None:
|
|
1062
1146
|
signode += addnodes.desc_sig_keyword('noexcept', 'noexcept')
|
|
1063
1147
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
1064
1148
|
self.expr.describe_signature(signode, mode, env, symbol)
|
|
@@ -1066,8 +1150,13 @@ class ASTNoexceptExpr(ASTExpression):
|
|
|
1066
1150
|
|
|
1067
1151
|
|
|
1068
1152
|
class ASTNewExpr(ASTExpression):
|
|
1069
|
-
def __init__(
|
|
1070
|
-
|
|
1153
|
+
def __init__(
|
|
1154
|
+
self,
|
|
1155
|
+
rooted: bool,
|
|
1156
|
+
isNewTypeId: bool,
|
|
1157
|
+
typ: ASTType,
|
|
1158
|
+
initList: ASTParenExprList | ASTBracedInitList,
|
|
1159
|
+
) -> None:
|
|
1071
1160
|
self.rooted = rooted
|
|
1072
1161
|
self.isNewTypeId = isNewTypeId
|
|
1073
1162
|
self.typ = typ
|
|
@@ -1104,16 +1193,16 @@ class ASTNewExpr(ASTExpression):
|
|
|
1104
1193
|
# the array part will be in the type mangling, so na is not used
|
|
1105
1194
|
res = ['nw']
|
|
1106
1195
|
# TODO: placement
|
|
1107
|
-
res.
|
|
1108
|
-
res.append(self.typ.get_id(version))
|
|
1196
|
+
res.extend(('_', self.typ.get_id(version)))
|
|
1109
1197
|
if self.initList is not None:
|
|
1110
1198
|
res.append(self.initList.get_id(version))
|
|
1111
1199
|
else:
|
|
1112
1200
|
res.append('E')
|
|
1113
1201
|
return ''.join(res)
|
|
1114
1202
|
|
|
1115
|
-
def describe_signature(
|
|
1116
|
-
|
|
1203
|
+
def describe_signature(
|
|
1204
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1205
|
+
) -> None:
|
|
1117
1206
|
if self.rooted:
|
|
1118
1207
|
signode += addnodes.desc_sig_punctuation('::', '::')
|
|
1119
1208
|
signode += addnodes.desc_sig_keyword('new', 'new')
|
|
@@ -1157,13 +1246,14 @@ class ASTDeleteExpr(ASTExpression):
|
|
|
1157
1246
|
|
|
1158
1247
|
def get_id(self, version: int) -> str:
|
|
1159
1248
|
if self.array:
|
|
1160
|
-
id =
|
|
1249
|
+
id = 'da'
|
|
1161
1250
|
else:
|
|
1162
|
-
id =
|
|
1251
|
+
id = 'dl'
|
|
1163
1252
|
return id + self.expr.get_id(version)
|
|
1164
1253
|
|
|
1165
|
-
def describe_signature(
|
|
1166
|
-
|
|
1254
|
+
def describe_signature(
|
|
1255
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1256
|
+
) -> None:
|
|
1167
1257
|
if self.rooted:
|
|
1168
1258
|
signode += addnodes.desc_sig_punctuation('::', '::')
|
|
1169
1259
|
signode += addnodes.desc_sig_keyword('delete', 'delete')
|
|
@@ -1177,6 +1267,7 @@ class ASTDeleteExpr(ASTExpression):
|
|
|
1177
1267
|
# Other expressions
|
|
1178
1268
|
################################################################################
|
|
1179
1269
|
|
|
1270
|
+
|
|
1180
1271
|
class ASTCastExpr(ASTExpression):
|
|
1181
1272
|
def __init__(self, typ: ASTType, expr: ASTExpression) -> None:
|
|
1182
1273
|
self.typ = typ
|
|
@@ -1185,26 +1276,26 @@ class ASTCastExpr(ASTExpression):
|
|
|
1185
1276
|
def __eq__(self, other: object) -> bool:
|
|
1186
1277
|
if not isinstance(other, ASTCastExpr):
|
|
1187
1278
|
return NotImplemented
|
|
1188
|
-
return
|
|
1189
|
-
self.typ == other.typ
|
|
1190
|
-
and self.expr == other.expr
|
|
1191
|
-
)
|
|
1279
|
+
return self.typ == other.typ and self.expr == other.expr
|
|
1192
1280
|
|
|
1193
1281
|
def __hash__(self) -> int:
|
|
1194
1282
|
return hash((self.typ, self.expr))
|
|
1195
1283
|
|
|
1196
1284
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
1197
1285
|
res = ['(']
|
|
1198
|
-
res.
|
|
1199
|
-
|
|
1200
|
-
|
|
1286
|
+
res.extend((
|
|
1287
|
+
transform(self.typ),
|
|
1288
|
+
')',
|
|
1289
|
+
transform(self.expr),
|
|
1290
|
+
))
|
|
1201
1291
|
return ''.join(res)
|
|
1202
1292
|
|
|
1203
1293
|
def get_id(self, version: int) -> str:
|
|
1204
1294
|
return 'cv' + self.typ.get_id(version) + self.expr.get_id(version)
|
|
1205
1295
|
|
|
1206
|
-
def describe_signature(
|
|
1207
|
-
|
|
1296
|
+
def describe_signature(
|
|
1297
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1298
|
+
) -> None:
|
|
1208
1299
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
1209
1300
|
self.typ.describe_signature(signode, mode, env, symbol)
|
|
1210
1301
|
signode += addnodes.desc_sig_punctuation(')', ')')
|
|
@@ -1221,35 +1312,33 @@ class ASTBinOpExpr(ASTExpression):
|
|
|
1221
1312
|
def __eq__(self, other: object) -> bool:
|
|
1222
1313
|
if not isinstance(other, ASTBinOpExpr):
|
|
1223
1314
|
return NotImplemented
|
|
1224
|
-
return
|
|
1225
|
-
self.exprs == other.exprs
|
|
1226
|
-
and self.ops == other.ops
|
|
1227
|
-
)
|
|
1315
|
+
return self.exprs == other.exprs and self.ops == other.ops
|
|
1228
1316
|
|
|
1229
1317
|
def __hash__(self) -> int:
|
|
1230
1318
|
return hash((self.exprs, self.ops))
|
|
1231
1319
|
|
|
1232
1320
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
1233
|
-
res = []
|
|
1234
|
-
res.append(transform(self.exprs[0]))
|
|
1321
|
+
res = [transform(self.exprs[0])]
|
|
1235
1322
|
for i in range(1, len(self.exprs)):
|
|
1236
|
-
res.
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1323
|
+
res.extend((
|
|
1324
|
+
' ',
|
|
1325
|
+
self.ops[i - 1],
|
|
1326
|
+
' ',
|
|
1327
|
+
transform(self.exprs[i]),
|
|
1328
|
+
))
|
|
1240
1329
|
return ''.join(res)
|
|
1241
1330
|
|
|
1242
1331
|
def get_id(self, version: int) -> str:
|
|
1243
1332
|
assert version >= 2
|
|
1244
|
-
res = []
|
|
1333
|
+
res: list[str] = []
|
|
1245
1334
|
for i in range(len(self.ops)):
|
|
1246
|
-
res.
|
|
1247
|
-
res.append(self.exprs[i].get_id(version))
|
|
1335
|
+
res.extend((_id_operator_v2[self.ops[i]], self.exprs[i].get_id(version)))
|
|
1248
1336
|
res.append(self.exprs[-1].get_id(version))
|
|
1249
1337
|
return ''.join(res)
|
|
1250
1338
|
|
|
1251
|
-
def describe_signature(
|
|
1252
|
-
|
|
1339
|
+
def describe_signature(
|
|
1340
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1341
|
+
) -> None:
|
|
1253
1342
|
self.exprs[0].describe_signature(signode, mode, env, symbol)
|
|
1254
1343
|
for i in range(1, len(self.exprs)):
|
|
1255
1344
|
signode += addnodes.desc_sig_space()
|
|
@@ -1263,8 +1352,9 @@ class ASTBinOpExpr(ASTExpression):
|
|
|
1263
1352
|
|
|
1264
1353
|
|
|
1265
1354
|
class ASTConditionalExpr(ASTExpression):
|
|
1266
|
-
def __init__(
|
|
1267
|
-
|
|
1355
|
+
def __init__(
|
|
1356
|
+
self, ifExpr: ASTExpression, thenExpr: ASTExpression, elseExpr: ASTExpression
|
|
1357
|
+
) -> None:
|
|
1268
1358
|
self.ifExpr = ifExpr
|
|
1269
1359
|
self.thenExpr = thenExpr
|
|
1270
1360
|
self.elseExpr = elseExpr
|
|
@@ -1282,25 +1372,30 @@ class ASTConditionalExpr(ASTExpression):
|
|
|
1282
1372
|
return hash((self.ifExpr, self.thenExpr, self.elseExpr))
|
|
1283
1373
|
|
|
1284
1374
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
1285
|
-
res = []
|
|
1286
|
-
res.
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1375
|
+
res: list[str] = []
|
|
1376
|
+
res.extend((
|
|
1377
|
+
transform(self.ifExpr),
|
|
1378
|
+
' ? ',
|
|
1379
|
+
transform(self.thenExpr),
|
|
1380
|
+
' : ',
|
|
1381
|
+
transform(self.elseExpr),
|
|
1382
|
+
))
|
|
1291
1383
|
return ''.join(res)
|
|
1292
1384
|
|
|
1293
1385
|
def get_id(self, version: int) -> str:
|
|
1294
1386
|
assert version >= 2
|
|
1295
|
-
res = []
|
|
1296
|
-
res.
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1387
|
+
res: list[str] = []
|
|
1388
|
+
res.extend((
|
|
1389
|
+
_id_operator_v2['?'],
|
|
1390
|
+
self.ifExpr.get_id(version),
|
|
1391
|
+
self.thenExpr.get_id(version),
|
|
1392
|
+
self.elseExpr.get_id(version),
|
|
1393
|
+
))
|
|
1300
1394
|
return ''.join(res)
|
|
1301
1395
|
|
|
1302
|
-
def describe_signature(
|
|
1303
|
-
|
|
1396
|
+
def describe_signature(
|
|
1397
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1398
|
+
) -> None:
|
|
1304
1399
|
self.ifExpr.describe_signature(signode, mode, env, symbol)
|
|
1305
1400
|
signode += addnodes.desc_sig_space()
|
|
1306
1401
|
signode += addnodes.desc_sig_operator('?', '?')
|
|
@@ -1313,8 +1408,9 @@ class ASTConditionalExpr(ASTExpression):
|
|
|
1313
1408
|
|
|
1314
1409
|
|
|
1315
1410
|
class ASTBracedInitList(ASTBase):
|
|
1316
|
-
def __init__(
|
|
1317
|
-
|
|
1411
|
+
def __init__(
|
|
1412
|
+
self, exprs: list[ASTExpression | ASTBracedInitList], trailingComma: bool
|
|
1413
|
+
) -> None:
|
|
1318
1414
|
self.exprs = exprs
|
|
1319
1415
|
self.trailingComma = trailingComma
|
|
1320
1416
|
|
|
@@ -1327,15 +1423,16 @@ class ASTBracedInitList(ASTBase):
|
|
|
1327
1423
|
return hash((self.exprs, self.trailingComma))
|
|
1328
1424
|
|
|
1329
1425
|
def get_id(self, version: int) -> str:
|
|
1330
|
-
return
|
|
1426
|
+
return 'il%sE' % ''.join(e.get_id(version) for e in self.exprs)
|
|
1331
1427
|
|
|
1332
1428
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
1333
1429
|
exprs = ', '.join(transform(e) for e in self.exprs)
|
|
1334
|
-
|
|
1335
|
-
return f'{{{exprs}{
|
|
1430
|
+
trailing_comma = ',' if self.trailingComma else ''
|
|
1431
|
+
return f'{{{exprs}{trailing_comma}}}'
|
|
1336
1432
|
|
|
1337
|
-
def describe_signature(
|
|
1338
|
-
|
|
1433
|
+
def describe_signature(
|
|
1434
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1435
|
+
) -> None:
|
|
1339
1436
|
verify_description_mode(mode)
|
|
1340
1437
|
signode += addnodes.desc_sig_punctuation('{', '{')
|
|
1341
1438
|
first = True
|
|
@@ -1352,8 +1449,12 @@ class ASTBracedInitList(ASTBase):
|
|
|
1352
1449
|
|
|
1353
1450
|
|
|
1354
1451
|
class ASTAssignmentExpr(ASTExpression):
|
|
1355
|
-
def __init__(
|
|
1356
|
-
|
|
1452
|
+
def __init__(
|
|
1453
|
+
self,
|
|
1454
|
+
leftExpr: ASTExpression,
|
|
1455
|
+
op: str,
|
|
1456
|
+
rightExpr: ASTExpression | ASTBracedInitList,
|
|
1457
|
+
) -> None:
|
|
1357
1458
|
self.leftExpr = leftExpr
|
|
1358
1459
|
self.op = op
|
|
1359
1460
|
self.rightExpr = rightExpr
|
|
@@ -1371,24 +1472,29 @@ class ASTAssignmentExpr(ASTExpression):
|
|
|
1371
1472
|
return hash((self.leftExpr, self.op, self.rightExpr))
|
|
1372
1473
|
|
|
1373
1474
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
1374
|
-
res = []
|
|
1375
|
-
res.
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1475
|
+
res: list[str] = []
|
|
1476
|
+
res.extend((
|
|
1477
|
+
transform(self.leftExpr),
|
|
1478
|
+
' ',
|
|
1479
|
+
self.op,
|
|
1480
|
+
' ',
|
|
1481
|
+
transform(self.rightExpr),
|
|
1482
|
+
))
|
|
1380
1483
|
return ''.join(res)
|
|
1381
1484
|
|
|
1382
1485
|
def get_id(self, version: int) -> str:
|
|
1383
1486
|
# we end up generating the ID from left to right, instead of right to left
|
|
1384
|
-
res = []
|
|
1385
|
-
res.
|
|
1386
|
-
|
|
1387
|
-
|
|
1487
|
+
res: list[str] = []
|
|
1488
|
+
res.extend((
|
|
1489
|
+
_id_operator_v2[self.op],
|
|
1490
|
+
self.leftExpr.get_id(version),
|
|
1491
|
+
self.rightExpr.get_id(version),
|
|
1492
|
+
))
|
|
1388
1493
|
return ''.join(res)
|
|
1389
1494
|
|
|
1390
|
-
def describe_signature(
|
|
1391
|
-
|
|
1495
|
+
def describe_signature(
|
|
1496
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1497
|
+
) -> None:
|
|
1392
1498
|
self.leftExpr.describe_signature(signode, mode, env, symbol)
|
|
1393
1499
|
signode += addnodes.desc_sig_space()
|
|
1394
1500
|
if ord(self.op[0]) >= ord('a') and ord(self.op[0]) <= ord('z'):
|
|
@@ -1417,15 +1523,15 @@ class ASTCommaExpr(ASTExpression):
|
|
|
1417
1523
|
|
|
1418
1524
|
def get_id(self, version: int) -> str:
|
|
1419
1525
|
id_ = _id_operator_v2[',']
|
|
1420
|
-
res = []
|
|
1526
|
+
res: list[str] = []
|
|
1421
1527
|
for i in range(len(self.exprs) - 1):
|
|
1422
|
-
res.
|
|
1423
|
-
res.append(self.exprs[i].get_id(version))
|
|
1528
|
+
res.extend((id_, self.exprs[i].get_id(version)))
|
|
1424
1529
|
res.append(self.exprs[-1].get_id(version))
|
|
1425
1530
|
return ''.join(res)
|
|
1426
1531
|
|
|
1427
|
-
def describe_signature(
|
|
1428
|
-
|
|
1532
|
+
def describe_signature(
|
|
1533
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1534
|
+
) -> None:
|
|
1429
1535
|
self.exprs[0].describe_signature(signode, mode, env, symbol)
|
|
1430
1536
|
for i in range(1, len(self.exprs)):
|
|
1431
1537
|
signode += addnodes.desc_sig_punctuation(',', ',')
|
|
@@ -1451,8 +1557,9 @@ class ASTFallbackExpr(ASTExpression):
|
|
|
1451
1557
|
def get_id(self, version: int) -> str:
|
|
1452
1558
|
return str(self.expr)
|
|
1453
1559
|
|
|
1454
|
-
def describe_signature(
|
|
1455
|
-
|
|
1560
|
+
def describe_signature(
|
|
1561
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1562
|
+
) -> None:
|
|
1456
1563
|
signode += nodes.literal(self.expr, self.expr)
|
|
1457
1564
|
|
|
1458
1565
|
|
|
@@ -1463,6 +1570,7 @@ class ASTFallbackExpr(ASTExpression):
|
|
|
1463
1570
|
# Things for ASTNestedName
|
|
1464
1571
|
################################################################################
|
|
1465
1572
|
|
|
1573
|
+
|
|
1466
1574
|
class ASTOperator(ASTBase):
|
|
1467
1575
|
is_anonymous: ClassVar[Literal[False]] = False
|
|
1468
1576
|
|
|
@@ -1481,25 +1589,40 @@ class ASTOperator(ASTBase):
|
|
|
1481
1589
|
def get_id(self, version: int) -> str:
|
|
1482
1590
|
raise NotImplementedError
|
|
1483
1591
|
|
|
1484
|
-
def _describe_identifier(
|
|
1485
|
-
|
|
1592
|
+
def _describe_identifier(
|
|
1593
|
+
self,
|
|
1594
|
+
signode: TextElement,
|
|
1595
|
+
identnode: TextElement,
|
|
1596
|
+
env: BuildEnvironment,
|
|
1597
|
+
symbol: Symbol,
|
|
1598
|
+
) -> None:
|
|
1486
1599
|
"""Render the prefix into signode, and the last part into identnode."""
|
|
1487
1600
|
raise NotImplementedError
|
|
1488
1601
|
|
|
1489
|
-
def describe_signature(
|
|
1490
|
-
|
|
1491
|
-
|
|
1602
|
+
def describe_signature(
|
|
1603
|
+
self,
|
|
1604
|
+
signode: TextElement,
|
|
1605
|
+
mode: str,
|
|
1606
|
+
env: BuildEnvironment,
|
|
1607
|
+
prefix: str,
|
|
1608
|
+
templateArgs: str,
|
|
1609
|
+
symbol: Symbol,
|
|
1610
|
+
) -> None:
|
|
1492
1611
|
verify_description_mode(mode)
|
|
1493
1612
|
if mode == 'lastIsName':
|
|
1494
|
-
|
|
1495
|
-
self._describe_identifier(
|
|
1496
|
-
signode +=
|
|
1613
|
+
main_name = addnodes.desc_name()
|
|
1614
|
+
self._describe_identifier(main_name, main_name, env, symbol)
|
|
1615
|
+
signode += main_name
|
|
1497
1616
|
elif mode == 'markType':
|
|
1498
|
-
|
|
1499
|
-
pnode = addnodes.pending_xref(
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1617
|
+
target_text = prefix + str(self) + templateArgs
|
|
1618
|
+
pnode = addnodes.pending_xref(
|
|
1619
|
+
'',
|
|
1620
|
+
refdomain='cpp',
|
|
1621
|
+
reftype='identifier',
|
|
1622
|
+
reftarget=target_text,
|
|
1623
|
+
modname=None,
|
|
1624
|
+
classname=None,
|
|
1625
|
+
)
|
|
1503
1626
|
pnode['cpp:parent_key'] = symbol.get_lookup_key()
|
|
1504
1627
|
# Render the identifier part, but collapse it into a string
|
|
1505
1628
|
# and make that the a link to this operator.
|
|
@@ -1511,9 +1634,9 @@ class ASTOperator(ASTBase):
|
|
|
1511
1634
|
pnode += addnodes.desc_name(txt, txt)
|
|
1512
1635
|
signode += pnode
|
|
1513
1636
|
else:
|
|
1514
|
-
|
|
1515
|
-
self._describe_identifier(
|
|
1516
|
-
signode +=
|
|
1637
|
+
add_name = addnodes.desc_addname()
|
|
1638
|
+
self._describe_identifier(add_name, add_name, env, symbol)
|
|
1639
|
+
signode += add_name
|
|
1517
1640
|
|
|
1518
1641
|
|
|
1519
1642
|
class ASTOperatorBuildIn(ASTOperator):
|
|
@@ -1536,20 +1659,27 @@ class ASTOperatorBuildIn(ASTOperator):
|
|
|
1536
1659
|
else:
|
|
1537
1660
|
ids = _id_operator_v2
|
|
1538
1661
|
if self.op not in ids:
|
|
1539
|
-
raise Exception(
|
|
1540
|
-
|
|
1662
|
+
raise Exception(
|
|
1663
|
+
'Internal error: Built-in operator "%s" can not '
|
|
1664
|
+
'be mapped to an id.' % self.op
|
|
1665
|
+
)
|
|
1541
1666
|
return ids[self.op]
|
|
1542
1667
|
|
|
1543
1668
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
1544
|
-
if self.op in
|
|
1669
|
+
if self.op in {'new', 'new[]', 'delete', 'delete[]'} or self.op[0] in 'abcnox':
|
|
1545
1670
|
return 'operator ' + self.op
|
|
1546
1671
|
else:
|
|
1547
1672
|
return 'operator' + self.op
|
|
1548
1673
|
|
|
1549
|
-
def _describe_identifier(
|
|
1550
|
-
|
|
1674
|
+
def _describe_identifier(
|
|
1675
|
+
self,
|
|
1676
|
+
signode: TextElement,
|
|
1677
|
+
identnode: TextElement,
|
|
1678
|
+
env: BuildEnvironment,
|
|
1679
|
+
symbol: Symbol,
|
|
1680
|
+
) -> None:
|
|
1551
1681
|
signode += addnodes.desc_sig_keyword('operator', 'operator')
|
|
1552
|
-
if self.op in
|
|
1682
|
+
if self.op in {'new', 'new[]', 'delete', 'delete[]'} or self.op[0] in 'abcnox':
|
|
1553
1683
|
signode += addnodes.desc_sig_space()
|
|
1554
1684
|
identnode += addnodes.desc_sig_operator(self.op, self.op)
|
|
1555
1685
|
|
|
@@ -1574,8 +1704,13 @@ class ASTOperatorLiteral(ASTOperator):
|
|
|
1574
1704
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
1575
1705
|
return 'operator""' + transform(self.identifier)
|
|
1576
1706
|
|
|
1577
|
-
def _describe_identifier(
|
|
1578
|
-
|
|
1707
|
+
def _describe_identifier(
|
|
1708
|
+
self,
|
|
1709
|
+
signode: TextElement,
|
|
1710
|
+
identnode: TextElement,
|
|
1711
|
+
env: BuildEnvironment,
|
|
1712
|
+
symbol: Symbol,
|
|
1713
|
+
) -> None:
|
|
1579
1714
|
signode += addnodes.desc_sig_keyword('operator', 'operator')
|
|
1580
1715
|
signode += addnodes.desc_sig_literal_string('""', '""')
|
|
1581
1716
|
self.identifier.describe_signature(identnode, 'markType', env, '', '', symbol)
|
|
@@ -1605,8 +1740,13 @@ class ASTOperatorType(ASTOperator):
|
|
|
1605
1740
|
def get_name_no_template(self) -> str:
|
|
1606
1741
|
return str(self)
|
|
1607
1742
|
|
|
1608
|
-
def _describe_identifier(
|
|
1609
|
-
|
|
1743
|
+
def _describe_identifier(
|
|
1744
|
+
self,
|
|
1745
|
+
signode: TextElement,
|
|
1746
|
+
identnode: TextElement,
|
|
1747
|
+
env: BuildEnvironment,
|
|
1748
|
+
symbol: Symbol,
|
|
1749
|
+
) -> None:
|
|
1610
1750
|
signode += addnodes.desc_sig_keyword('operator', 'operator')
|
|
1611
1751
|
signode += addnodes.desc_sig_space()
|
|
1612
1752
|
self.type.describe_signature(identnode, 'markType', env, symbol)
|
|
@@ -1634,15 +1774,17 @@ class ASTTemplateArgConstant(ASTBase):
|
|
|
1634
1774
|
return 'X' + str(self) + 'E'
|
|
1635
1775
|
return 'X' + self.value.get_id(version) + 'E'
|
|
1636
1776
|
|
|
1637
|
-
def describe_signature(
|
|
1638
|
-
|
|
1777
|
+
def describe_signature(
|
|
1778
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1779
|
+
) -> None:
|
|
1639
1780
|
verify_description_mode(mode)
|
|
1640
1781
|
self.value.describe_signature(signode, mode, env, symbol)
|
|
1641
1782
|
|
|
1642
1783
|
|
|
1643
1784
|
class ASTTemplateArgs(ASTBase):
|
|
1644
|
-
def __init__(
|
|
1645
|
-
|
|
1785
|
+
def __init__(
|
|
1786
|
+
self, args: list[ASTType | ASTTemplateArgConstant], packExpansion: bool
|
|
1787
|
+
) -> None:
|
|
1646
1788
|
assert args is not None
|
|
1647
1789
|
self.args = args
|
|
1648
1790
|
self.packExpansion = packExpansion
|
|
@@ -1657,14 +1799,15 @@ class ASTTemplateArgs(ASTBase):
|
|
|
1657
1799
|
|
|
1658
1800
|
def get_id(self, version: int) -> str:
|
|
1659
1801
|
if version == 1:
|
|
1660
|
-
res = []
|
|
1661
|
-
res.
|
|
1662
|
-
|
|
1663
|
-
|
|
1802
|
+
res: list[str] = []
|
|
1803
|
+
res.extend((
|
|
1804
|
+
':',
|
|
1805
|
+
'.'.join(a.get_id(version) for a in self.args),
|
|
1806
|
+
':',
|
|
1807
|
+
))
|
|
1664
1808
|
return ''.join(res)
|
|
1665
1809
|
|
|
1666
|
-
res = []
|
|
1667
|
-
res.append('I')
|
|
1810
|
+
res = ['I']
|
|
1668
1811
|
if len(self.args) > 0:
|
|
1669
1812
|
for a in self.args[:-1]:
|
|
1670
1813
|
res.append(a.get_id(version))
|
|
@@ -1682,8 +1825,9 @@ class ASTTemplateArgs(ASTBase):
|
|
|
1682
1825
|
res += '...'
|
|
1683
1826
|
return '<' + res + '>'
|
|
1684
1827
|
|
|
1685
|
-
def describe_signature(
|
|
1686
|
-
|
|
1828
|
+
def describe_signature(
|
|
1829
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1830
|
+
) -> None:
|
|
1687
1831
|
verify_description_mode(mode)
|
|
1688
1832
|
signode += addnodes.desc_sig_punctuation('<', '<')
|
|
1689
1833
|
first = True
|
|
@@ -1701,12 +1845,14 @@ class ASTTemplateArgs(ASTBase):
|
|
|
1701
1845
|
# Main part of declarations
|
|
1702
1846
|
################################################################################
|
|
1703
1847
|
|
|
1848
|
+
|
|
1704
1849
|
class ASTTrailingTypeSpec(ASTBase):
|
|
1705
1850
|
def get_id(self, version: int) -> str:
|
|
1706
1851
|
raise NotImplementedError(repr(self))
|
|
1707
1852
|
|
|
1708
|
-
def describe_signature(
|
|
1709
|
-
|
|
1853
|
+
def describe_signature(
|
|
1854
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1855
|
+
) -> None:
|
|
1710
1856
|
raise NotImplementedError(repr(self))
|
|
1711
1857
|
|
|
1712
1858
|
|
|
@@ -1744,11 +1890,13 @@ class ASTTrailingTypeSpecFundamental(ASTTrailingTypeSpec):
|
|
|
1744
1890
|
raise Exception(
|
|
1745
1891
|
'Semi-internal error: Fundamental type "%s" can not be mapped '
|
|
1746
1892
|
'to an ID. Is it a true fundamental type? If not so, the '
|
|
1747
|
-
'parser should have rejected it.' % txt
|
|
1893
|
+
'parser should have rejected it.' % txt
|
|
1894
|
+
)
|
|
1748
1895
|
return _id_fundamental_v2[txt]
|
|
1749
1896
|
|
|
1750
|
-
def describe_signature(
|
|
1751
|
-
|
|
1897
|
+
def describe_signature(
|
|
1898
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1899
|
+
) -> None:
|
|
1752
1900
|
first = True
|
|
1753
1901
|
for n in self.names:
|
|
1754
1902
|
if not first:
|
|
@@ -1773,8 +1921,9 @@ class ASTTrailingTypeSpecDecltypeAuto(ASTTrailingTypeSpec):
|
|
|
1773
1921
|
raise NoOldIdError
|
|
1774
1922
|
return 'Dc'
|
|
1775
1923
|
|
|
1776
|
-
def describe_signature(
|
|
1777
|
-
|
|
1924
|
+
def describe_signature(
|
|
1925
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1926
|
+
) -> None:
|
|
1778
1927
|
signode += addnodes.desc_sig_keyword('decltype', 'decltype')
|
|
1779
1928
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
1780
1929
|
signode += addnodes.desc_sig_keyword('auto', 'auto')
|
|
@@ -1799,10 +1948,11 @@ class ASTTrailingTypeSpecDecltype(ASTTrailingTypeSpec):
|
|
|
1799
1948
|
def get_id(self, version: int) -> str:
|
|
1800
1949
|
if version == 1:
|
|
1801
1950
|
raise NoOldIdError
|
|
1802
|
-
return 'DT' + self.expr.get_id(version) +
|
|
1951
|
+
return 'DT' + self.expr.get_id(version) + 'E'
|
|
1803
1952
|
|
|
1804
|
-
def describe_signature(
|
|
1805
|
-
|
|
1953
|
+
def describe_signature(
|
|
1954
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
1955
|
+
) -> None:
|
|
1806
1956
|
signode += addnodes.desc_sig_keyword('decltype', 'decltype')
|
|
1807
1957
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
1808
1958
|
self.expr.describe_signature(signode, mode, env, symbol)
|
|
@@ -1810,8 +1960,9 @@ class ASTTrailingTypeSpecDecltype(ASTTrailingTypeSpec):
|
|
|
1810
1960
|
|
|
1811
1961
|
|
|
1812
1962
|
class ASTTrailingTypeSpecName(ASTTrailingTypeSpec):
|
|
1813
|
-
def __init__(
|
|
1814
|
-
|
|
1963
|
+
def __init__(
|
|
1964
|
+
self, prefix: str, nestedName: ASTNestedName, placeholderType: str | None
|
|
1965
|
+
) -> None:
|
|
1815
1966
|
self.prefix = prefix
|
|
1816
1967
|
self.nestedName = nestedName
|
|
1817
1968
|
self.placeholderType = placeholderType
|
|
@@ -1836,18 +1987,17 @@ class ASTTrailingTypeSpecName(ASTTrailingTypeSpec):
|
|
|
1836
1987
|
return self.nestedName.get_id(version)
|
|
1837
1988
|
|
|
1838
1989
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
1839
|
-
res = []
|
|
1990
|
+
res: list[str] = []
|
|
1840
1991
|
if self.prefix:
|
|
1841
|
-
res.
|
|
1842
|
-
res.append(' ')
|
|
1992
|
+
res.extend((self.prefix, ' '))
|
|
1843
1993
|
res.append(transform(self.nestedName))
|
|
1844
1994
|
if self.placeholderType is not None:
|
|
1845
|
-
res.
|
|
1846
|
-
res.append(self.placeholderType)
|
|
1995
|
+
res.extend((' ', self.placeholderType))
|
|
1847
1996
|
return ''.join(res)
|
|
1848
1997
|
|
|
1849
|
-
def describe_signature(
|
|
1850
|
-
|
|
1998
|
+
def describe_signature(
|
|
1999
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2000
|
+
) -> None:
|
|
1851
2001
|
if self.prefix:
|
|
1852
2002
|
signode += addnodes.desc_sig_keyword(self.prefix, self.prefix)
|
|
1853
2003
|
signode += addnodes.desc_sig_space()
|
|
@@ -1866,8 +2016,11 @@ class ASTTrailingTypeSpecName(ASTTrailingTypeSpec):
|
|
|
1866
2016
|
|
|
1867
2017
|
|
|
1868
2018
|
class ASTFunctionParameter(ASTBase):
|
|
1869
|
-
def __init__(
|
|
1870
|
-
|
|
2019
|
+
def __init__(
|
|
2020
|
+
self,
|
|
2021
|
+
arg: ASTTypeWithInit | ASTTemplateParamConstrainedTypeWithInit,
|
|
2022
|
+
ellipsis: bool = False,
|
|
2023
|
+
) -> None:
|
|
1871
2024
|
self.arg = arg
|
|
1872
2025
|
self.ellipsis = ellipsis
|
|
1873
2026
|
|
|
@@ -1880,7 +2033,7 @@ class ASTFunctionParameter(ASTBase):
|
|
|
1880
2033
|
return hash((self.arg, self.ellipsis))
|
|
1881
2034
|
|
|
1882
2035
|
def get_id(
|
|
1883
|
-
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
2036
|
+
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
1884
2037
|
) -> str:
|
|
1885
2038
|
# this is not part of the normal name mangling in C++
|
|
1886
2039
|
if symbol:
|
|
@@ -1898,8 +2051,9 @@ class ASTFunctionParameter(ASTBase):
|
|
|
1898
2051
|
else:
|
|
1899
2052
|
return transform(self.arg)
|
|
1900
2053
|
|
|
1901
|
-
def describe_signature(
|
|
1902
|
-
|
|
2054
|
+
def describe_signature(
|
|
2055
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2056
|
+
) -> None:
|
|
1903
2057
|
verify_description_mode(mode)
|
|
1904
2058
|
if self.ellipsis:
|
|
1905
2059
|
signode += addnodes.desc_sig_punctuation('...', '...')
|
|
@@ -1924,8 +2078,9 @@ class ASTNoexceptSpec(ASTBase):
|
|
|
1924
2078
|
return 'noexcept(' + transform(self.expr) + ')'
|
|
1925
2079
|
return 'noexcept'
|
|
1926
2080
|
|
|
1927
|
-
def describe_signature(
|
|
1928
|
-
|
|
2081
|
+
def describe_signature(
|
|
2082
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2083
|
+
) -> None:
|
|
1929
2084
|
signode += addnodes.desc_sig_keyword('noexcept', 'noexcept')
|
|
1930
2085
|
if self.expr:
|
|
1931
2086
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
@@ -1934,11 +2089,19 @@ class ASTNoexceptSpec(ASTBase):
|
|
|
1934
2089
|
|
|
1935
2090
|
|
|
1936
2091
|
class ASTParametersQualifiers(ASTBase):
|
|
1937
|
-
def __init__(
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
2092
|
+
def __init__(
|
|
2093
|
+
self,
|
|
2094
|
+
args: list[ASTFunctionParameter],
|
|
2095
|
+
volatile: bool,
|
|
2096
|
+
const: bool,
|
|
2097
|
+
refQual: str | None,
|
|
2098
|
+
exceptionSpec: ASTNoexceptSpec,
|
|
2099
|
+
trailingReturn: ASTType,
|
|
2100
|
+
override: bool,
|
|
2101
|
+
final: bool,
|
|
2102
|
+
attrs: ASTAttributeList,
|
|
2103
|
+
initializer: str | None,
|
|
2104
|
+
) -> None:
|
|
1942
2105
|
self.args = args
|
|
1943
2106
|
self.volatile = volatile
|
|
1944
2107
|
self.const = const
|
|
@@ -1968,8 +2131,16 @@ class ASTParametersQualifiers(ASTBase):
|
|
|
1968
2131
|
|
|
1969
2132
|
def __hash__(self) -> int:
|
|
1970
2133
|
return hash((
|
|
1971
|
-
self.args,
|
|
1972
|
-
self.
|
|
2134
|
+
self.args,
|
|
2135
|
+
self.volatile,
|
|
2136
|
+
self.const,
|
|
2137
|
+
self.refQual,
|
|
2138
|
+
self.exceptionSpec,
|
|
2139
|
+
self.trailingReturn,
|
|
2140
|
+
self.override,
|
|
2141
|
+
self.final,
|
|
2142
|
+
self.attrs,
|
|
2143
|
+
self.initializer,
|
|
1973
2144
|
))
|
|
1974
2145
|
|
|
1975
2146
|
@property
|
|
@@ -2003,8 +2174,7 @@ class ASTParametersQualifiers(ASTBase):
|
|
|
2003
2174
|
return ''.join(a.get_id(version) for a in self.args)
|
|
2004
2175
|
|
|
2005
2176
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
2006
|
-
res = []
|
|
2007
|
-
res.append('(')
|
|
2177
|
+
res = ['(']
|
|
2008
2178
|
first = True
|
|
2009
2179
|
for a in self.args:
|
|
2010
2180
|
if not first:
|
|
@@ -2017,28 +2187,24 @@ class ASTParametersQualifiers(ASTBase):
|
|
|
2017
2187
|
if self.const:
|
|
2018
2188
|
res.append(' const')
|
|
2019
2189
|
if self.refQual:
|
|
2020
|
-
res.
|
|
2021
|
-
res.append(self.refQual)
|
|
2190
|
+
res.extend((' ', self.refQual))
|
|
2022
2191
|
if self.exceptionSpec:
|
|
2023
|
-
res.
|
|
2024
|
-
res.append(transform(self.exceptionSpec))
|
|
2192
|
+
res.extend((' ', transform(self.exceptionSpec)))
|
|
2025
2193
|
if self.trailingReturn:
|
|
2026
|
-
res.
|
|
2027
|
-
res.append(transform(self.trailingReturn))
|
|
2194
|
+
res.extend((' -> ', transform(self.trailingReturn)))
|
|
2028
2195
|
if self.final:
|
|
2029
2196
|
res.append(' final')
|
|
2030
2197
|
if self.override:
|
|
2031
2198
|
res.append(' override')
|
|
2032
2199
|
if len(self.attrs) != 0:
|
|
2033
|
-
res.
|
|
2034
|
-
res.append(transform(self.attrs))
|
|
2200
|
+
res.extend((' ', transform(self.attrs)))
|
|
2035
2201
|
if self.initializer:
|
|
2036
|
-
res.
|
|
2037
|
-
res.append(self.initializer)
|
|
2202
|
+
res.extend((' = ', self.initializer))
|
|
2038
2203
|
return ''.join(res)
|
|
2039
2204
|
|
|
2040
|
-
def describe_signature(
|
|
2041
|
-
|
|
2205
|
+
def describe_signature(
|
|
2206
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2207
|
+
) -> None:
|
|
2042
2208
|
verify_description_mode(mode)
|
|
2043
2209
|
multi_line_parameter_list = False
|
|
2044
2210
|
test_node: Element = signode
|
|
@@ -2046,7 +2212,9 @@ class ASTParametersQualifiers(ASTBase):
|
|
|
2046
2212
|
if not isinstance(test_node, addnodes.desc_signature):
|
|
2047
2213
|
test_node = test_node.parent
|
|
2048
2214
|
continue
|
|
2049
|
-
multi_line_parameter_list = test_node.get(
|
|
2215
|
+
multi_line_parameter_list = test_node.get(
|
|
2216
|
+
'multi_line_parameter_list', False
|
|
2217
|
+
)
|
|
2050
2218
|
break
|
|
2051
2219
|
|
|
2052
2220
|
# only use the desc_parameterlist for the outer list, not for inner lists
|
|
@@ -2099,7 +2267,7 @@ class ASTParametersQualifiers(ASTBase):
|
|
|
2099
2267
|
signode += addnodes.desc_sig_space()
|
|
2100
2268
|
signode += addnodes.desc_sig_punctuation('=', '=')
|
|
2101
2269
|
signode += addnodes.desc_sig_space()
|
|
2102
|
-
assert self.initializer in
|
|
2270
|
+
assert self.initializer in {'0', 'delete', 'default'}
|
|
2103
2271
|
if self.initializer == '0':
|
|
2104
2272
|
signode += addnodes.desc_sig_literal_number('0', '0')
|
|
2105
2273
|
else:
|
|
@@ -2121,13 +2289,12 @@ class ASTExplicitSpec(ASTBase):
|
|
|
2121
2289
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
2122
2290
|
res = ['explicit']
|
|
2123
2291
|
if self.expr is not None:
|
|
2124
|
-
res.
|
|
2125
|
-
res.append(transform(self.expr))
|
|
2126
|
-
res.append(')')
|
|
2292
|
+
res.extend(('(', transform(self.expr), ')'))
|
|
2127
2293
|
return ''.join(res)
|
|
2128
2294
|
|
|
2129
|
-
def describe_signature(
|
|
2130
|
-
|
|
2295
|
+
def describe_signature(
|
|
2296
|
+
self, signode: TextElement, env: BuildEnvironment, symbol: Symbol
|
|
2297
|
+
) -> None:
|
|
2131
2298
|
signode += addnodes.desc_sig_keyword('explicit', 'explicit')
|
|
2132
2299
|
if self.expr is not None:
|
|
2133
2300
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
@@ -2136,11 +2303,21 @@ class ASTExplicitSpec(ASTBase):
|
|
|
2136
2303
|
|
|
2137
2304
|
|
|
2138
2305
|
class ASTDeclSpecsSimple(ASTBase):
|
|
2139
|
-
def __init__(
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2306
|
+
def __init__(
|
|
2307
|
+
self,
|
|
2308
|
+
storage: str,
|
|
2309
|
+
threadLocal: bool,
|
|
2310
|
+
inline: bool,
|
|
2311
|
+
virtual: bool,
|
|
2312
|
+
explicitSpec: ASTExplicitSpec | None,
|
|
2313
|
+
consteval: bool,
|
|
2314
|
+
constexpr: bool,
|
|
2315
|
+
constinit: bool,
|
|
2316
|
+
volatile: bool,
|
|
2317
|
+
const: bool,
|
|
2318
|
+
friend: bool,
|
|
2319
|
+
attrs: ASTAttributeList,
|
|
2320
|
+
) -> None:
|
|
2144
2321
|
self.storage = storage
|
|
2145
2322
|
self.threadLocal = threadLocal
|
|
2146
2323
|
self.inline = inline
|
|
@@ -2191,18 +2368,20 @@ class ASTDeclSpecsSimple(ASTBase):
|
|
|
2191
2368
|
def mergeWith(self, other: ASTDeclSpecsSimple) -> ASTDeclSpecsSimple:
|
|
2192
2369
|
if not other:
|
|
2193
2370
|
return self
|
|
2194
|
-
return ASTDeclSpecsSimple(
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2371
|
+
return ASTDeclSpecsSimple(
|
|
2372
|
+
self.storage or other.storage,
|
|
2373
|
+
self.threadLocal or other.threadLocal,
|
|
2374
|
+
self.inline or other.inline,
|
|
2375
|
+
self.virtual or other.virtual,
|
|
2376
|
+
self.explicitSpec or other.explicitSpec,
|
|
2377
|
+
self.consteval or other.consteval,
|
|
2378
|
+
self.constexpr or other.constexpr,
|
|
2379
|
+
self.constinit or other.constinit,
|
|
2380
|
+
self.volatile or other.volatile,
|
|
2381
|
+
self.const or other.const,
|
|
2382
|
+
self.friend or other.friend,
|
|
2383
|
+
self.attrs + other.attrs,
|
|
2384
|
+
)
|
|
2206
2385
|
|
|
2207
2386
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
2208
2387
|
res: list[str] = []
|
|
@@ -2232,48 +2411,53 @@ class ASTDeclSpecsSimple(ASTBase):
|
|
|
2232
2411
|
res.append('const')
|
|
2233
2412
|
return ' '.join(res)
|
|
2234
2413
|
|
|
2235
|
-
def describe_signature(
|
|
2236
|
-
|
|
2414
|
+
def describe_signature(
|
|
2415
|
+
self, signode: TextElement, env: BuildEnvironment, symbol: Symbol
|
|
2416
|
+
) -> None:
|
|
2237
2417
|
self.attrs.describe_signature(signode)
|
|
2238
|
-
|
|
2418
|
+
add_space = len(self.attrs) != 0
|
|
2239
2419
|
|
|
2240
2420
|
def _add(signode: TextElement, text: str) -> bool:
|
|
2241
|
-
if
|
|
2421
|
+
if add_space:
|
|
2242
2422
|
signode += addnodes.desc_sig_space()
|
|
2243
2423
|
signode += addnodes.desc_sig_keyword(text, text)
|
|
2244
2424
|
return True
|
|
2245
2425
|
|
|
2246
2426
|
if self.storage:
|
|
2247
|
-
|
|
2427
|
+
add_space = _add(signode, self.storage)
|
|
2248
2428
|
if self.threadLocal:
|
|
2249
|
-
|
|
2429
|
+
add_space = _add(signode, 'thread_local')
|
|
2250
2430
|
if self.inline:
|
|
2251
|
-
|
|
2431
|
+
add_space = _add(signode, 'inline')
|
|
2252
2432
|
if self.friend:
|
|
2253
|
-
|
|
2433
|
+
add_space = _add(signode, 'friend')
|
|
2254
2434
|
if self.virtual:
|
|
2255
|
-
|
|
2435
|
+
add_space = _add(signode, 'virtual')
|
|
2256
2436
|
if self.explicitSpec:
|
|
2257
|
-
if
|
|
2437
|
+
if add_space:
|
|
2258
2438
|
signode += addnodes.desc_sig_space()
|
|
2259
2439
|
self.explicitSpec.describe_signature(signode, env, symbol)
|
|
2260
|
-
|
|
2440
|
+
add_space = True
|
|
2261
2441
|
if self.consteval:
|
|
2262
|
-
|
|
2442
|
+
add_space = _add(signode, 'consteval')
|
|
2263
2443
|
if self.constexpr:
|
|
2264
|
-
|
|
2444
|
+
add_space = _add(signode, 'constexpr')
|
|
2265
2445
|
if self.constinit:
|
|
2266
|
-
|
|
2446
|
+
add_space = _add(signode, 'constinit')
|
|
2267
2447
|
if self.volatile:
|
|
2268
|
-
|
|
2448
|
+
add_space = _add(signode, 'volatile')
|
|
2269
2449
|
if self.const:
|
|
2270
|
-
|
|
2450
|
+
add_space = _add(signode, 'const')
|
|
2271
2451
|
|
|
2272
2452
|
|
|
2273
2453
|
class ASTDeclSpecs(ASTBase):
|
|
2274
|
-
def __init__(
|
|
2275
|
-
|
|
2276
|
-
|
|
2454
|
+
def __init__(
|
|
2455
|
+
self,
|
|
2456
|
+
outer: str,
|
|
2457
|
+
leftSpecs: ASTDeclSpecsSimple,
|
|
2458
|
+
rightSpecs: ASTDeclSpecsSimple,
|
|
2459
|
+
trailing: ASTTrailingTypeSpec,
|
|
2460
|
+
) -> None:
|
|
2277
2461
|
# leftSpecs and rightSpecs are used for output
|
|
2278
2462
|
# allSpecs are used for id generation
|
|
2279
2463
|
self.outer = outer
|
|
@@ -2302,8 +2486,7 @@ class ASTDeclSpecs(ASTBase):
|
|
|
2302
2486
|
|
|
2303
2487
|
def get_id(self, version: int) -> str:
|
|
2304
2488
|
if version == 1:
|
|
2305
|
-
res = []
|
|
2306
|
-
res.append(self.trailingTypeSpec.get_id(version))
|
|
2489
|
+
res = [self.trailingTypeSpec.get_id(version)]
|
|
2307
2490
|
if self.allSpecs.volatile:
|
|
2308
2491
|
res.append('V')
|
|
2309
2492
|
if self.allSpecs.const:
|
|
@@ -2325,32 +2508,32 @@ class ASTDeclSpecs(ASTBase):
|
|
|
2325
2508
|
res.append(l)
|
|
2326
2509
|
if self.trailingTypeSpec:
|
|
2327
2510
|
if len(res) > 0:
|
|
2328
|
-
res.append(
|
|
2511
|
+
res.append(' ')
|
|
2329
2512
|
res.append(transform(self.trailingTypeSpec))
|
|
2330
2513
|
r = str(self.rightSpecs)
|
|
2331
2514
|
if len(r) > 0:
|
|
2332
2515
|
if len(res) > 0:
|
|
2333
|
-
res.append(
|
|
2516
|
+
res.append(' ')
|
|
2334
2517
|
res.append(r)
|
|
2335
|
-
return
|
|
2518
|
+
return ''.join(res)
|
|
2336
2519
|
|
|
2337
|
-
def describe_signature(
|
|
2338
|
-
|
|
2520
|
+
def describe_signature(
|
|
2521
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2522
|
+
) -> None:
|
|
2339
2523
|
verify_description_mode(mode)
|
|
2340
|
-
|
|
2524
|
+
num_children = len(signode)
|
|
2341
2525
|
self.leftSpecs.describe_signature(signode, env, symbol)
|
|
2342
|
-
|
|
2526
|
+
add_space = len(signode) != num_children
|
|
2343
2527
|
|
|
2344
2528
|
if self.trailingTypeSpec:
|
|
2345
|
-
if
|
|
2529
|
+
if add_space:
|
|
2346
2530
|
signode += addnodes.desc_sig_space()
|
|
2347
|
-
|
|
2348
|
-
self.trailingTypeSpec.describe_signature(signode, mode, env,
|
|
2349
|
-
|
|
2350
|
-
addSpace = len(signode) != numChildren
|
|
2531
|
+
num_children = len(signode)
|
|
2532
|
+
self.trailingTypeSpec.describe_signature(signode, mode, env, symbol=symbol)
|
|
2533
|
+
add_space = len(signode) != num_children
|
|
2351
2534
|
|
|
2352
2535
|
if len(str(self.rightSpecs)) > 0:
|
|
2353
|
-
if
|
|
2536
|
+
if add_space:
|
|
2354
2537
|
signode += addnodes.desc_sig_space()
|
|
2355
2538
|
self.rightSpecs.describe_signature(signode, env, symbol)
|
|
2356
2539
|
|
|
@@ -2358,6 +2541,7 @@ class ASTDeclSpecs(ASTBase):
|
|
|
2358
2541
|
# Declarator
|
|
2359
2542
|
################################################################################
|
|
2360
2543
|
|
|
2544
|
+
|
|
2361
2545
|
class ASTArray(ASTBase):
|
|
2362
2546
|
def __init__(self, size: ASTExpression) -> None:
|
|
2363
2547
|
self.size = size
|
|
@@ -2389,8 +2573,9 @@ class ASTArray(ASTBase):
|
|
|
2389
2573
|
else:
|
|
2390
2574
|
return 'A_'
|
|
2391
2575
|
|
|
2392
|
-
def describe_signature(
|
|
2393
|
-
|
|
2576
|
+
def describe_signature(
|
|
2577
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2578
|
+
) -> None:
|
|
2394
2579
|
verify_description_mode(mode)
|
|
2395
2580
|
signode += addnodes.desc_sig_punctuation('[', '[')
|
|
2396
2581
|
if self.size:
|
|
@@ -2437,15 +2622,19 @@ class ASTDeclarator(ASTBase):
|
|
|
2437
2622
|
def is_function_type(self) -> bool:
|
|
2438
2623
|
raise NotImplementedError(repr(self))
|
|
2439
2624
|
|
|
2440
|
-
def describe_signature(
|
|
2441
|
-
|
|
2625
|
+
def describe_signature(
|
|
2626
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2627
|
+
) -> None:
|
|
2442
2628
|
raise NotImplementedError(repr(self))
|
|
2443
2629
|
|
|
2444
2630
|
|
|
2445
2631
|
class ASTDeclaratorNameParamQual(ASTDeclarator):
|
|
2446
|
-
def __init__(
|
|
2447
|
-
|
|
2448
|
-
|
|
2632
|
+
def __init__(
|
|
2633
|
+
self,
|
|
2634
|
+
declId: ASTNestedName,
|
|
2635
|
+
arrayOps: list[ASTArray],
|
|
2636
|
+
paramQual: ASTParametersQualifiers,
|
|
2637
|
+
) -> None:
|
|
2449
2638
|
self.declId = declId
|
|
2450
2639
|
self.arrayOps = arrayOps
|
|
2451
2640
|
self.paramQual = paramQual
|
|
@@ -2487,7 +2676,7 @@ class ASTDeclaratorNameParamQual(ASTDeclarator):
|
|
|
2487
2676
|
# cv-qualifiers
|
|
2488
2677
|
if self.paramQual:
|
|
2489
2678
|
return self.paramQual.get_modifiers_id(version)
|
|
2490
|
-
raise Exception(
|
|
2679
|
+
raise Exception('This should only be called on a function: %s' % self)
|
|
2491
2680
|
|
|
2492
2681
|
def get_param_id(self, version: int) -> str: # only the parameters (if any)
|
|
2493
2682
|
if self.paramQual:
|
|
@@ -2500,15 +2689,16 @@ class ASTDeclaratorNameParamQual(ASTDeclarator):
|
|
|
2500
2689
|
|
|
2501
2690
|
def get_type_id(self, version: int, returnTypeId: str) -> str:
|
|
2502
2691
|
assert version >= 2
|
|
2503
|
-
res = []
|
|
2692
|
+
res = [self.get_ptr_suffix_id(version)]
|
|
2504
2693
|
# TODO: can we actually have both array ops and paramQual?
|
|
2505
|
-
res.append(self.get_ptr_suffix_id(version))
|
|
2506
2694
|
if self.paramQual:
|
|
2507
|
-
res.
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2695
|
+
res.extend((
|
|
2696
|
+
self.get_modifiers_id(version),
|
|
2697
|
+
'F',
|
|
2698
|
+
returnTypeId,
|
|
2699
|
+
self.get_param_id(version),
|
|
2700
|
+
'E',
|
|
2701
|
+
))
|
|
2512
2702
|
else:
|
|
2513
2703
|
res.append(returnTypeId)
|
|
2514
2704
|
return ''.join(res)
|
|
@@ -2530,8 +2720,9 @@ class ASTDeclaratorNameParamQual(ASTDeclarator):
|
|
|
2530
2720
|
res.append(transform(self.paramQual))
|
|
2531
2721
|
return ''.join(res)
|
|
2532
2722
|
|
|
2533
|
-
def describe_signature(
|
|
2534
|
-
|
|
2723
|
+
def describe_signature(
|
|
2724
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2725
|
+
) -> None:
|
|
2535
2726
|
verify_description_mode(mode)
|
|
2536
2727
|
if self.declId:
|
|
2537
2728
|
self.declId.describe_signature(signode, mode, env, symbol)
|
|
@@ -2580,12 +2771,12 @@ class ASTDeclaratorNameBitField(ASTDeclarator):
|
|
|
2580
2771
|
res = []
|
|
2581
2772
|
if self.declId:
|
|
2582
2773
|
res.append(transform(self.declId))
|
|
2583
|
-
res.
|
|
2584
|
-
res.append(transform(self.size))
|
|
2774
|
+
res.extend((' : ', transform(self.size)))
|
|
2585
2775
|
return ''.join(res)
|
|
2586
2776
|
|
|
2587
|
-
def describe_signature(
|
|
2588
|
-
|
|
2777
|
+
def describe_signature(
|
|
2778
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2779
|
+
) -> None:
|
|
2589
2780
|
verify_description_mode(mode)
|
|
2590
2781
|
if self.declId:
|
|
2591
2782
|
self.declId.describe_signature(signode, mode, env, symbol)
|
|
@@ -2596,8 +2787,9 @@ class ASTDeclaratorNameBitField(ASTDeclarator):
|
|
|
2596
2787
|
|
|
2597
2788
|
|
|
2598
2789
|
class ASTDeclaratorPtr(ASTDeclarator):
|
|
2599
|
-
def __init__(
|
|
2600
|
-
|
|
2790
|
+
def __init__(
|
|
2791
|
+
self, next: ASTDeclarator, volatile: bool, const: bool, attrs: ASTAttributeList
|
|
2792
|
+
) -> None:
|
|
2601
2793
|
assert next
|
|
2602
2794
|
self.next = next
|
|
2603
2795
|
self.volatile = volatile
|
|
@@ -2641,8 +2833,7 @@ class ASTDeclaratorPtr(ASTDeclarator):
|
|
|
2641
2833
|
return self.next.require_space_after_declSpecs()
|
|
2642
2834
|
|
|
2643
2835
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
2644
|
-
res = ['*']
|
|
2645
|
-
res.append(transform(self.attrs))
|
|
2836
|
+
res = ['*', transform(self.attrs)]
|
|
2646
2837
|
if len(self.attrs) != 0 and (self.volatile or self.const):
|
|
2647
2838
|
res.append(' ')
|
|
2648
2839
|
if self.volatile:
|
|
@@ -2673,8 +2864,7 @@ class ASTDeclaratorPtr(ASTDeclarator):
|
|
|
2673
2864
|
res.append(self.next.get_ptr_suffix_id(version))
|
|
2674
2865
|
return ''.join(res)
|
|
2675
2866
|
|
|
2676
|
-
res = [self.next.get_ptr_suffix_id(version)]
|
|
2677
|
-
res.append('P')
|
|
2867
|
+
res = [self.next.get_ptr_suffix_id(version), 'P']
|
|
2678
2868
|
if self.volatile:
|
|
2679
2869
|
res.append('V')
|
|
2680
2870
|
if self.const:
|
|
@@ -2694,8 +2884,9 @@ class ASTDeclaratorPtr(ASTDeclarator):
|
|
|
2694
2884
|
def is_function_type(self) -> bool:
|
|
2695
2885
|
return self.next.is_function_type()
|
|
2696
2886
|
|
|
2697
|
-
def describe_signature(
|
|
2698
|
-
|
|
2887
|
+
def describe_signature(
|
|
2888
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2889
|
+
) -> None:
|
|
2699
2890
|
verify_description_mode(mode)
|
|
2700
2891
|
signode += addnodes.desc_sig_punctuation('*', '*')
|
|
2701
2892
|
self.attrs.describe_signature(signode)
|
|
@@ -2704,6 +2895,7 @@ class ASTDeclaratorPtr(ASTDeclarator):
|
|
|
2704
2895
|
|
|
2705
2896
|
def _add_anno(signode: TextElement, text: str) -> None:
|
|
2706
2897
|
signode += addnodes.desc_sig_keyword(text, text)
|
|
2898
|
+
|
|
2707
2899
|
if self.volatile:
|
|
2708
2900
|
_add_anno(signode, 'volatile')
|
|
2709
2901
|
if self.const:
|
|
@@ -2754,8 +2946,7 @@ class ASTDeclaratorRef(ASTDeclarator):
|
|
|
2754
2946
|
return self.next.require_space_after_declSpecs()
|
|
2755
2947
|
|
|
2756
2948
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
2757
|
-
res = ['&']
|
|
2758
|
-
res.append(transform(self.attrs))
|
|
2949
|
+
res = ['&', transform(self.attrs)]
|
|
2759
2950
|
if len(self.attrs) != 0 and self.next.require_space_after_declSpecs():
|
|
2760
2951
|
res.append(' ')
|
|
2761
2952
|
res.append(transform(self.next))
|
|
@@ -2781,8 +2972,9 @@ class ASTDeclaratorRef(ASTDeclarator):
|
|
|
2781
2972
|
def is_function_type(self) -> bool:
|
|
2782
2973
|
return self.next.is_function_type()
|
|
2783
2974
|
|
|
2784
|
-
def describe_signature(
|
|
2785
|
-
|
|
2975
|
+
def describe_signature(
|
|
2976
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
2977
|
+
) -> None:
|
|
2786
2978
|
verify_description_mode(mode)
|
|
2787
2979
|
signode += addnodes.desc_sig_punctuation('&', '&')
|
|
2788
2980
|
self.attrs.describe_signature(signode)
|
|
@@ -2853,8 +3045,9 @@ class ASTDeclaratorParamPack(ASTDeclarator):
|
|
|
2853
3045
|
def is_function_type(self) -> bool:
|
|
2854
3046
|
return self.next.is_function_type()
|
|
2855
3047
|
|
|
2856
|
-
def describe_signature(
|
|
2857
|
-
|
|
3048
|
+
def describe_signature(
|
|
3049
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3050
|
+
) -> None:
|
|
2858
3051
|
verify_description_mode(mode)
|
|
2859
3052
|
signode += addnodes.desc_sig_punctuation('...', '...')
|
|
2860
3053
|
if self.next.name:
|
|
@@ -2863,8 +3056,9 @@ class ASTDeclaratorParamPack(ASTDeclarator):
|
|
|
2863
3056
|
|
|
2864
3057
|
|
|
2865
3058
|
class ASTDeclaratorMemPtr(ASTDeclarator):
|
|
2866
|
-
def __init__(
|
|
2867
|
-
|
|
3059
|
+
def __init__(
|
|
3060
|
+
self, className: ASTNestedName, const: bool, volatile: bool, next: ASTDeclarator
|
|
3061
|
+
) -> None:
|
|
2868
3062
|
assert className
|
|
2869
3063
|
assert next
|
|
2870
3064
|
self.className = className
|
|
@@ -2909,9 +3103,8 @@ class ASTDeclaratorMemPtr(ASTDeclarator):
|
|
|
2909
3103
|
return True
|
|
2910
3104
|
|
|
2911
3105
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
2912
|
-
res = []
|
|
2913
|
-
res.
|
|
2914
|
-
res.append('::*')
|
|
3106
|
+
res: list[str] = []
|
|
3107
|
+
res.extend((transform(self.className), '::*'))
|
|
2915
3108
|
if self.volatile:
|
|
2916
3109
|
res.append('volatile')
|
|
2917
3110
|
if self.const:
|
|
@@ -2942,21 +3135,22 @@ class ASTDeclaratorMemPtr(ASTDeclarator):
|
|
|
2942
3135
|
def get_type_id(self, version: int, returnTypeId: str) -> str:
|
|
2943
3136
|
assert version >= 2
|
|
2944
3137
|
# ReturnType name::* next, so we are part of the return type of next
|
|
2945
|
-
|
|
3138
|
+
next_return_type_id = ''
|
|
2946
3139
|
if self.volatile:
|
|
2947
|
-
|
|
3140
|
+
next_return_type_id += 'V'
|
|
2948
3141
|
if self.const:
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
return self.next.get_type_id(version,
|
|
3142
|
+
next_return_type_id += 'K'
|
|
3143
|
+
next_return_type_id += 'M'
|
|
3144
|
+
next_return_type_id += self.className.get_id(version)
|
|
3145
|
+
next_return_type_id += returnTypeId
|
|
3146
|
+
return self.next.get_type_id(version, next_return_type_id)
|
|
2954
3147
|
|
|
2955
3148
|
def is_function_type(self) -> bool:
|
|
2956
3149
|
return self.next.is_function_type()
|
|
2957
3150
|
|
|
2958
|
-
def describe_signature(
|
|
2959
|
-
|
|
3151
|
+
def describe_signature(
|
|
3152
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3153
|
+
) -> None:
|
|
2960
3154
|
verify_description_mode(mode)
|
|
2961
3155
|
self.className.describe_signature(signode, 'markType', env, symbol)
|
|
2962
3156
|
signode += addnodes.desc_sig_punctuation('::', '::')
|
|
@@ -2964,6 +3158,7 @@ class ASTDeclaratorMemPtr(ASTDeclarator):
|
|
|
2964
3158
|
|
|
2965
3159
|
def _add_anno(signode: TextElement, text: str) -> None:
|
|
2966
3160
|
signode += addnodes.desc_sig_keyword(text, text)
|
|
3161
|
+
|
|
2967
3162
|
if self.volatile:
|
|
2968
3163
|
_add_anno(signode, 'volatile')
|
|
2969
3164
|
if self.const:
|
|
@@ -3016,9 +3211,11 @@ class ASTDeclaratorParen(ASTDeclarator):
|
|
|
3016
3211
|
|
|
3017
3212
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3018
3213
|
res = ['(']
|
|
3019
|
-
res.
|
|
3020
|
-
|
|
3021
|
-
|
|
3214
|
+
res.extend((
|
|
3215
|
+
transform(self.inner),
|
|
3216
|
+
')',
|
|
3217
|
+
transform(self.next),
|
|
3218
|
+
))
|
|
3022
3219
|
return ''.join(res)
|
|
3023
3220
|
|
|
3024
3221
|
def get_modifiers_id(self, version: int) -> str:
|
|
@@ -3030,32 +3227,36 @@ class ASTDeclaratorParen(ASTDeclarator):
|
|
|
3030
3227
|
def get_ptr_suffix_id(self, version: int) -> str:
|
|
3031
3228
|
if version == 1:
|
|
3032
3229
|
raise NoOldIdError # TODO: was this implemented before?
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3230
|
+
ptr_suffix_id_next = self.next.get_ptr_suffix_id(version)
|
|
3231
|
+
ptr_suffix_id_inner = self.inner.get_ptr_suffix_id(version)
|
|
3232
|
+
return ptr_suffix_id_next + ptr_suffix_id_inner
|
|
3233
|
+
ptr_suffix_id_inner = self.inner.get_ptr_suffix_id(version)
|
|
3234
|
+
ptr_suffix_id_next = self.next.get_ptr_suffix_id(version)
|
|
3235
|
+
return ptr_suffix_id_inner + ptr_suffix_id_next
|
|
3037
3236
|
|
|
3038
3237
|
def get_type_id(self, version: int, returnTypeId: str) -> str:
|
|
3039
3238
|
assert version >= 2
|
|
3040
3239
|
# ReturnType (inner)next, so 'inner' returns everything outside
|
|
3041
|
-
|
|
3042
|
-
return self.inner.get_type_id(version, returnTypeId=
|
|
3240
|
+
next_id = self.next.get_type_id(version, returnTypeId)
|
|
3241
|
+
return self.inner.get_type_id(version, returnTypeId=next_id)
|
|
3043
3242
|
|
|
3044
3243
|
def is_function_type(self) -> bool:
|
|
3045
3244
|
return self.inner.is_function_type()
|
|
3046
3245
|
|
|
3047
|
-
def describe_signature(
|
|
3048
|
-
|
|
3246
|
+
def describe_signature(
|
|
3247
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3248
|
+
) -> None:
|
|
3049
3249
|
verify_description_mode(mode)
|
|
3050
3250
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
3051
3251
|
self.inner.describe_signature(signode, mode, env, symbol)
|
|
3052
3252
|
signode += addnodes.desc_sig_punctuation(')', ')')
|
|
3053
|
-
self.next.describe_signature(signode,
|
|
3253
|
+
self.next.describe_signature(signode, 'noneIsName', env, symbol)
|
|
3054
3254
|
|
|
3055
3255
|
|
|
3056
3256
|
# Type and initializer stuff
|
|
3057
3257
|
##############################################################################################
|
|
3058
3258
|
|
|
3259
|
+
|
|
3059
3260
|
class ASTPackExpansionExpr(ASTExpression):
|
|
3060
3261
|
def __init__(self, expr: ASTExpression | ASTBracedInitList) -> None:
|
|
3061
3262
|
self.expr = expr
|
|
@@ -3075,8 +3276,9 @@ class ASTPackExpansionExpr(ASTExpression):
|
|
|
3075
3276
|
id = self.expr.get_id(version)
|
|
3076
3277
|
return 'sp' + id
|
|
3077
3278
|
|
|
3078
|
-
def describe_signature(
|
|
3079
|
-
|
|
3279
|
+
def describe_signature(
|
|
3280
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3281
|
+
) -> None:
|
|
3080
3282
|
self.expr.describe_signature(signode, mode, env, symbol)
|
|
3081
3283
|
signode += addnodes.desc_sig_punctuation('...', '...')
|
|
3082
3284
|
|
|
@@ -3094,14 +3296,15 @@ class ASTParenExprList(ASTBaseParenExprList):
|
|
|
3094
3296
|
return hash(self.exprs)
|
|
3095
3297
|
|
|
3096
3298
|
def get_id(self, version: int) -> str:
|
|
3097
|
-
return
|
|
3299
|
+
return 'pi%sE' % ''.join(e.get_id(version) for e in self.exprs)
|
|
3098
3300
|
|
|
3099
3301
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3100
3302
|
exprs = [transform(e) for e in self.exprs]
|
|
3101
3303
|
return '(%s)' % ', '.join(exprs)
|
|
3102
3304
|
|
|
3103
|
-
def describe_signature(
|
|
3104
|
-
|
|
3305
|
+
def describe_signature(
|
|
3306
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3307
|
+
) -> None:
|
|
3105
3308
|
verify_description_mode(mode)
|
|
3106
3309
|
signode += addnodes.desc_sig_punctuation('(', '(')
|
|
3107
3310
|
first = True
|
|
@@ -3116,8 +3319,9 @@ class ASTParenExprList(ASTBaseParenExprList):
|
|
|
3116
3319
|
|
|
3117
3320
|
|
|
3118
3321
|
class ASTInitializer(ASTBase):
|
|
3119
|
-
def __init__(
|
|
3120
|
-
|
|
3322
|
+
def __init__(
|
|
3323
|
+
self, value: ASTExpression | ASTBracedInitList, hasAssign: bool = True
|
|
3324
|
+
) -> None:
|
|
3121
3325
|
self.value = value
|
|
3122
3326
|
self.hasAssign = hasAssign
|
|
3123
3327
|
|
|
@@ -3136,8 +3340,9 @@ class ASTInitializer(ASTBase):
|
|
|
3136
3340
|
else:
|
|
3137
3341
|
return val
|
|
3138
3342
|
|
|
3139
|
-
def describe_signature(
|
|
3140
|
-
|
|
3343
|
+
def describe_signature(
|
|
3344
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3345
|
+
) -> None:
|
|
3141
3346
|
verify_description_mode(mode)
|
|
3142
3347
|
if self.hasAssign:
|
|
3143
3348
|
signode += addnodes.desc_sig_space()
|
|
@@ -3181,18 +3386,22 @@ class ASTType(ASTBase):
|
|
|
3181
3386
|
def trailingReturn(self) -> ASTType:
|
|
3182
3387
|
return self.decl.trailingReturn
|
|
3183
3388
|
|
|
3184
|
-
def get_id(
|
|
3185
|
-
|
|
3389
|
+
def get_id(
|
|
3390
|
+
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
3391
|
+
) -> str:
|
|
3186
3392
|
if version == 1:
|
|
3187
|
-
res = []
|
|
3393
|
+
res: list[str] = []
|
|
3188
3394
|
if objectType: # needs the name
|
|
3189
3395
|
if objectType == 'function': # also modifiers
|
|
3190
|
-
res.
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3396
|
+
res.extend((
|
|
3397
|
+
symbol.get_full_nested_name().get_id(version),
|
|
3398
|
+
self.decl.get_param_id(version),
|
|
3399
|
+
self.decl.get_modifiers_id(version),
|
|
3400
|
+
))
|
|
3401
|
+
if self.declSpecs.leftSpecs.constexpr or (
|
|
3402
|
+
self.declSpecs.rightSpecs
|
|
3403
|
+
and self.declSpecs.rightSpecs.constexpr
|
|
3404
|
+
):
|
|
3196
3405
|
res.append('CE')
|
|
3197
3406
|
elif objectType == 'type': # just the name
|
|
3198
3407
|
res.append(symbol.get_full_nested_name().get_id(version))
|
|
@@ -3201,9 +3410,11 @@ class ASTType(ASTBase):
|
|
|
3201
3410
|
else: # only type encoding
|
|
3202
3411
|
if self.decl.is_function_type():
|
|
3203
3412
|
raise NoOldIdError
|
|
3204
|
-
res.
|
|
3205
|
-
|
|
3206
|
-
|
|
3413
|
+
res.extend((
|
|
3414
|
+
self.declSpecs.get_id(version),
|
|
3415
|
+
self.decl.get_ptr_suffix_id(version),
|
|
3416
|
+
self.decl.get_param_id(version),
|
|
3417
|
+
))
|
|
3207
3418
|
return ''.join(res)
|
|
3208
3419
|
# other versions
|
|
3209
3420
|
res = []
|
|
@@ -3215,13 +3426,13 @@ class ASTType(ASTBase):
|
|
|
3215
3426
|
# with templates we need to mangle the return type in as well
|
|
3216
3427
|
templ = symbol.declaration.templatePrefix
|
|
3217
3428
|
if templ is not None:
|
|
3218
|
-
|
|
3429
|
+
type_id = self.decl.get_ptr_suffix_id(version)
|
|
3219
3430
|
if self.trailingReturn:
|
|
3220
|
-
|
|
3431
|
+
return_type_id = self.trailingReturn.get_id(version)
|
|
3221
3432
|
else:
|
|
3222
|
-
|
|
3223
|
-
res.append(
|
|
3224
|
-
res.append(
|
|
3433
|
+
return_type_id = self.declSpecs.get_id(version)
|
|
3434
|
+
res.append(type_id)
|
|
3435
|
+
res.append(return_type_id)
|
|
3225
3436
|
res.append(self.decl.get_param_id(version))
|
|
3226
3437
|
elif objectType == 'type': # just the name
|
|
3227
3438
|
res.append(symbol.get_full_nested_name().get_id(version))
|
|
@@ -3230,16 +3441,16 @@ class ASTType(ASTBase):
|
|
|
3230
3441
|
else: # only type encoding
|
|
3231
3442
|
# the 'returnType' of a non-function type is simply just the last
|
|
3232
3443
|
# type, i.e., for 'int*' it is 'int'
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
res.append(
|
|
3444
|
+
return_type_id = self.declSpecs.get_id(version)
|
|
3445
|
+
type_id = self.decl.get_type_id(version, return_type_id)
|
|
3446
|
+
res.append(type_id)
|
|
3236
3447
|
return ''.join(res)
|
|
3237
3448
|
|
|
3238
3449
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3239
3450
|
res = []
|
|
3240
|
-
|
|
3241
|
-
res.append(
|
|
3242
|
-
if self.decl.require_space_after_declSpecs() and len(
|
|
3451
|
+
decl_specs = transform(self.declSpecs)
|
|
3452
|
+
res.append(decl_specs)
|
|
3453
|
+
if self.decl.require_space_after_declSpecs() and len(decl_specs) > 0:
|
|
3243
3454
|
res.append(' ')
|
|
3244
3455
|
res.append(transform(self.decl))
|
|
3245
3456
|
return ''.join(res)
|
|
@@ -3250,12 +3461,12 @@ class ASTType(ASTBase):
|
|
|
3250
3461
|
else:
|
|
3251
3462
|
return 'type'
|
|
3252
3463
|
|
|
3253
|
-
def describe_signature(
|
|
3254
|
-
|
|
3464
|
+
def describe_signature(
|
|
3465
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3466
|
+
) -> None:
|
|
3255
3467
|
verify_description_mode(mode)
|
|
3256
3468
|
self.declSpecs.describe_signature(signode, 'markType', env, symbol)
|
|
3257
|
-
if
|
|
3258
|
-
len(str(self.declSpecs)) > 0):
|
|
3469
|
+
if self.decl.require_space_after_declSpecs() and len(str(self.declSpecs)) > 0:
|
|
3259
3470
|
signode += addnodes.desc_sig_space()
|
|
3260
3471
|
# for parameters that don't really declare new names we get 'markType',
|
|
3261
3472
|
# this should not be propagated, but be 'noneIsName'.
|
|
@@ -3287,7 +3498,7 @@ class ASTTemplateParamConstrainedTypeWithInit(ASTBase):
|
|
|
3287
3498
|
return self.type.isPack
|
|
3288
3499
|
|
|
3289
3500
|
def get_id(
|
|
3290
|
-
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
3501
|
+
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
3291
3502
|
) -> str:
|
|
3292
3503
|
# this is not part of the normal name mangling in C++
|
|
3293
3504
|
assert version >= 2
|
|
@@ -3300,12 +3511,13 @@ class ASTTemplateParamConstrainedTypeWithInit(ASTBase):
|
|
|
3300
3511
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3301
3512
|
res = transform(self.type)
|
|
3302
3513
|
if self.init:
|
|
3303
|
-
res +=
|
|
3514
|
+
res += ' = '
|
|
3304
3515
|
res += transform(self.init)
|
|
3305
3516
|
return res
|
|
3306
3517
|
|
|
3307
|
-
def describe_signature(
|
|
3308
|
-
|
|
3518
|
+
def describe_signature(
|
|
3519
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3520
|
+
) -> None:
|
|
3309
3521
|
self.type.describe_signature(signode, mode, env, symbol)
|
|
3310
3522
|
if self.init:
|
|
3311
3523
|
signode += addnodes.desc_sig_space()
|
|
@@ -3335,24 +3547,28 @@ class ASTTypeWithInit(ASTBase):
|
|
|
3335
3547
|
def isPack(self) -> bool:
|
|
3336
3548
|
return self.type.isPack
|
|
3337
3549
|
|
|
3338
|
-
def get_id(
|
|
3339
|
-
|
|
3550
|
+
def get_id(
|
|
3551
|
+
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
3552
|
+
) -> str:
|
|
3340
3553
|
if objectType != 'member':
|
|
3341
3554
|
return self.type.get_id(version, objectType)
|
|
3342
3555
|
if version == 1:
|
|
3343
|
-
return (
|
|
3344
|
-
|
|
3556
|
+
return (
|
|
3557
|
+
symbol.get_full_nested_name().get_id(version)
|
|
3558
|
+
+ '__'
|
|
3559
|
+
+ self.type.get_id(version)
|
|
3560
|
+
)
|
|
3345
3561
|
return symbol.get_full_nested_name().get_id(version)
|
|
3346
3562
|
|
|
3347
3563
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3348
|
-
res = []
|
|
3349
|
-
res.append(transform(self.type))
|
|
3564
|
+
res = [transform(self.type)]
|
|
3350
3565
|
if self.init:
|
|
3351
3566
|
res.append(transform(self.init))
|
|
3352
3567
|
return ''.join(res)
|
|
3353
3568
|
|
|
3354
|
-
def describe_signature(
|
|
3355
|
-
|
|
3569
|
+
def describe_signature(
|
|
3570
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3571
|
+
) -> None:
|
|
3356
3572
|
verify_description_mode(mode)
|
|
3357
3573
|
self.type.describe_signature(signode, mode, env, symbol)
|
|
3358
3574
|
if self.init:
|
|
@@ -3372,25 +3588,25 @@ class ASTTypeUsing(ASTBase):
|
|
|
3372
3588
|
def __hash__(self) -> int:
|
|
3373
3589
|
return hash((self.name, self.type))
|
|
3374
3590
|
|
|
3375
|
-
def get_id(
|
|
3376
|
-
|
|
3591
|
+
def get_id(
|
|
3592
|
+
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
3593
|
+
) -> str:
|
|
3377
3594
|
if version == 1:
|
|
3378
3595
|
raise NoOldIdError
|
|
3379
3596
|
return symbol.get_full_nested_name().get_id(version)
|
|
3380
3597
|
|
|
3381
3598
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3382
|
-
res = []
|
|
3383
|
-
res.append(transform(self.name))
|
|
3599
|
+
res = [transform(self.name)]
|
|
3384
3600
|
if self.type:
|
|
3385
|
-
res.
|
|
3386
|
-
res.append(transform(self.type))
|
|
3601
|
+
res.extend((' = ', transform(self.type)))
|
|
3387
3602
|
return ''.join(res)
|
|
3388
3603
|
|
|
3389
3604
|
def get_type_declaration_prefix(self) -> str:
|
|
3390
3605
|
return 'using'
|
|
3391
3606
|
|
|
3392
|
-
def describe_signature(
|
|
3393
|
-
|
|
3607
|
+
def describe_signature(
|
|
3608
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3609
|
+
) -> None:
|
|
3394
3610
|
verify_description_mode(mode)
|
|
3395
3611
|
self.name.describe_signature(signode, mode, env, symbol=symbol)
|
|
3396
3612
|
if self.type:
|
|
@@ -3403,6 +3619,7 @@ class ASTTypeUsing(ASTBase):
|
|
|
3403
3619
|
# Other declarations
|
|
3404
3620
|
##############################################################################################
|
|
3405
3621
|
|
|
3622
|
+
|
|
3406
3623
|
class ASTConcept(ASTBase):
|
|
3407
3624
|
def __init__(self, nestedName: ASTNestedName, initializer: ASTInitializer) -> None:
|
|
3408
3625
|
self.nestedName = nestedName
|
|
@@ -3411,7 +3628,10 @@ class ASTConcept(ASTBase):
|
|
|
3411
3628
|
def __eq__(self, other: object) -> bool:
|
|
3412
3629
|
if not isinstance(other, ASTConcept):
|
|
3413
3630
|
return NotImplemented
|
|
3414
|
-
return
|
|
3631
|
+
return (
|
|
3632
|
+
self.nestedName == other.nestedName
|
|
3633
|
+
and self.initializer == other.initializer
|
|
3634
|
+
)
|
|
3415
3635
|
|
|
3416
3636
|
def __hash__(self) -> int:
|
|
3417
3637
|
return hash((self.nestedName, self.initializer))
|
|
@@ -3420,8 +3640,9 @@ class ASTConcept(ASTBase):
|
|
|
3420
3640
|
def name(self) -> ASTNestedName:
|
|
3421
3641
|
return self.nestedName
|
|
3422
3642
|
|
|
3423
|
-
def get_id(
|
|
3424
|
-
|
|
3643
|
+
def get_id(
|
|
3644
|
+
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
3645
|
+
) -> str:
|
|
3425
3646
|
if version == 1:
|
|
3426
3647
|
raise NoOldIdError
|
|
3427
3648
|
return symbol.get_full_nested_name().get_id(version)
|
|
@@ -3432,16 +3653,18 @@ class ASTConcept(ASTBase):
|
|
|
3432
3653
|
res += transform(self.initializer)
|
|
3433
3654
|
return res
|
|
3434
3655
|
|
|
3435
|
-
def describe_signature(
|
|
3436
|
-
|
|
3656
|
+
def describe_signature(
|
|
3657
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3658
|
+
) -> None:
|
|
3437
3659
|
self.nestedName.describe_signature(signode, mode, env, symbol)
|
|
3438
3660
|
if self.initializer:
|
|
3439
3661
|
self.initializer.describe_signature(signode, mode, env, symbol)
|
|
3440
3662
|
|
|
3441
3663
|
|
|
3442
3664
|
class ASTBaseClass(ASTBase):
|
|
3443
|
-
def __init__(
|
|
3444
|
-
|
|
3665
|
+
def __init__(
|
|
3666
|
+
self, name: ASTNestedName, visibility: str, virtual: bool, pack: bool
|
|
3667
|
+
) -> None:
|
|
3445
3668
|
self.name = name
|
|
3446
3669
|
self.visibility = visibility
|
|
3447
3670
|
self.virtual = virtual
|
|
@@ -3461,10 +3684,9 @@ class ASTBaseClass(ASTBase):
|
|
|
3461
3684
|
return hash((self.name, self.visibility, self.virtual, self.pack))
|
|
3462
3685
|
|
|
3463
3686
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3464
|
-
res = []
|
|
3687
|
+
res: list[str] = []
|
|
3465
3688
|
if self.visibility is not None:
|
|
3466
|
-
res.
|
|
3467
|
-
res.append(' ')
|
|
3689
|
+
res.extend((self.visibility, ' '))
|
|
3468
3690
|
if self.virtual:
|
|
3469
3691
|
res.append('virtual ')
|
|
3470
3692
|
res.append(transform(self.name))
|
|
@@ -3472,12 +3694,12 @@ class ASTBaseClass(ASTBase):
|
|
|
3472
3694
|
res.append('...')
|
|
3473
3695
|
return ''.join(res)
|
|
3474
3696
|
|
|
3475
|
-
def describe_signature(
|
|
3476
|
-
|
|
3697
|
+
def describe_signature(
|
|
3698
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3699
|
+
) -> None:
|
|
3477
3700
|
verify_description_mode(mode)
|
|
3478
3701
|
if self.visibility is not None:
|
|
3479
|
-
signode += addnodes.desc_sig_keyword(self.visibility,
|
|
3480
|
-
self.visibility)
|
|
3702
|
+
signode += addnodes.desc_sig_keyword(self.visibility, self.visibility)
|
|
3481
3703
|
signode += addnodes.desc_sig_space()
|
|
3482
3704
|
if self.virtual:
|
|
3483
3705
|
signode += addnodes.desc_sig_keyword('virtual', 'virtual')
|
|
@@ -3488,8 +3710,13 @@ class ASTBaseClass(ASTBase):
|
|
|
3488
3710
|
|
|
3489
3711
|
|
|
3490
3712
|
class ASTClass(ASTBase):
|
|
3491
|
-
def __init__(
|
|
3492
|
-
|
|
3713
|
+
def __init__(
|
|
3714
|
+
self,
|
|
3715
|
+
name: ASTNestedName,
|
|
3716
|
+
final: bool,
|
|
3717
|
+
bases: list[ASTBaseClass],
|
|
3718
|
+
attrs: ASTAttributeList,
|
|
3719
|
+
) -> None:
|
|
3493
3720
|
self.name = name
|
|
3494
3721
|
self.final = final
|
|
3495
3722
|
self.bases = bases
|
|
@@ -3512,8 +3739,7 @@ class ASTClass(ASTBase):
|
|
|
3512
3739
|
return symbol.get_full_nested_name().get_id(version)
|
|
3513
3740
|
|
|
3514
3741
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3515
|
-
res = []
|
|
3516
|
-
res.append(transform(self.attrs))
|
|
3742
|
+
res = [transform(self.attrs)]
|
|
3517
3743
|
if len(self.attrs) != 0:
|
|
3518
3744
|
res.append(' ')
|
|
3519
3745
|
res.append(transform(self.name))
|
|
@@ -3529,8 +3755,9 @@ class ASTClass(ASTBase):
|
|
|
3529
3755
|
res.append(transform(b))
|
|
3530
3756
|
return ''.join(res)
|
|
3531
3757
|
|
|
3532
|
-
def describe_signature(
|
|
3533
|
-
|
|
3758
|
+
def describe_signature(
|
|
3759
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3760
|
+
) -> None:
|
|
3534
3761
|
verify_description_mode(mode)
|
|
3535
3762
|
self.attrs.describe_signature(signode)
|
|
3536
3763
|
if len(self.attrs) != 0:
|
|
@@ -3570,15 +3797,15 @@ class ASTUnion(ASTBase):
|
|
|
3570
3797
|
return symbol.get_full_nested_name().get_id(version)
|
|
3571
3798
|
|
|
3572
3799
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3573
|
-
res = []
|
|
3574
|
-
res.append(transform(self.attrs))
|
|
3800
|
+
res = [transform(self.attrs)]
|
|
3575
3801
|
if len(self.attrs) != 0:
|
|
3576
3802
|
res.append(' ')
|
|
3577
3803
|
res.append(transform(self.name))
|
|
3578
3804
|
return ''.join(res)
|
|
3579
3805
|
|
|
3580
|
-
def describe_signature(
|
|
3581
|
-
|
|
3806
|
+
def describe_signature(
|
|
3807
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3808
|
+
) -> None:
|
|
3582
3809
|
verify_description_mode(mode)
|
|
3583
3810
|
self.attrs.describe_signature(signode)
|
|
3584
3811
|
if len(self.attrs) != 0:
|
|
@@ -3587,8 +3814,13 @@ class ASTUnion(ASTBase):
|
|
|
3587
3814
|
|
|
3588
3815
|
|
|
3589
3816
|
class ASTEnum(ASTBase):
|
|
3590
|
-
def __init__(
|
|
3591
|
-
|
|
3817
|
+
def __init__(
|
|
3818
|
+
self,
|
|
3819
|
+
name: ASTNestedName,
|
|
3820
|
+
scoped: str,
|
|
3821
|
+
underlyingType: ASTType,
|
|
3822
|
+
attrs: ASTAttributeList,
|
|
3823
|
+
) -> None:
|
|
3592
3824
|
self.name = name
|
|
3593
3825
|
self.scoped = scoped
|
|
3594
3826
|
self.underlyingType = underlyingType
|
|
@@ -3613,21 +3845,20 @@ class ASTEnum(ASTBase):
|
|
|
3613
3845
|
return symbol.get_full_nested_name().get_id(version)
|
|
3614
3846
|
|
|
3615
3847
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3616
|
-
res = []
|
|
3848
|
+
res: list[str] = []
|
|
3617
3849
|
if self.scoped:
|
|
3618
|
-
res.
|
|
3619
|
-
res.append(' ')
|
|
3850
|
+
res.extend((self.scoped, ' '))
|
|
3620
3851
|
res.append(transform(self.attrs))
|
|
3621
3852
|
if len(self.attrs) != 0:
|
|
3622
3853
|
res.append(' ')
|
|
3623
3854
|
res.append(transform(self.name))
|
|
3624
3855
|
if self.underlyingType:
|
|
3625
|
-
res.
|
|
3626
|
-
res.append(transform(self.underlyingType))
|
|
3856
|
+
res.extend((' : ', transform(self.underlyingType)))
|
|
3627
3857
|
return ''.join(res)
|
|
3628
3858
|
|
|
3629
|
-
def describe_signature(
|
|
3630
|
-
|
|
3859
|
+
def describe_signature(
|
|
3860
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3861
|
+
) -> None:
|
|
3631
3862
|
verify_description_mode(mode)
|
|
3632
3863
|
# self.scoped has been done by the CPPEnumObject
|
|
3633
3864
|
self.attrs.describe_signature(signode)
|
|
@@ -3638,13 +3869,15 @@ class ASTEnum(ASTBase):
|
|
|
3638
3869
|
signode += addnodes.desc_sig_space()
|
|
3639
3870
|
signode += addnodes.desc_sig_punctuation(':', ':')
|
|
3640
3871
|
signode += addnodes.desc_sig_space()
|
|
3641
|
-
self.underlyingType.describe_signature(
|
|
3642
|
-
|
|
3872
|
+
self.underlyingType.describe_signature(
|
|
3873
|
+
signode, 'noneIsName', env, symbol=symbol
|
|
3874
|
+
)
|
|
3643
3875
|
|
|
3644
3876
|
|
|
3645
3877
|
class ASTEnumerator(ASTBase):
|
|
3646
|
-
def __init__(
|
|
3647
|
-
|
|
3878
|
+
def __init__(
|
|
3879
|
+
self, name: ASTNestedName, init: ASTInitializer | None, attrs: ASTAttributeList
|
|
3880
|
+
) -> None:
|
|
3648
3881
|
self.name = name
|
|
3649
3882
|
self.init = init
|
|
3650
3883
|
self.attrs = attrs
|
|
@@ -3667,17 +3900,16 @@ class ASTEnumerator(ASTBase):
|
|
|
3667
3900
|
return symbol.get_full_nested_name().get_id(version)
|
|
3668
3901
|
|
|
3669
3902
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3670
|
-
res = []
|
|
3671
|
-
res.append(transform(self.name))
|
|
3903
|
+
res = [transform(self.name)]
|
|
3672
3904
|
if len(self.attrs) != 0:
|
|
3673
|
-
res.
|
|
3674
|
-
res.append(transform(self.attrs))
|
|
3905
|
+
res.extend((' ', transform(self.attrs)))
|
|
3675
3906
|
if self.init:
|
|
3676
3907
|
res.append(transform(self.init))
|
|
3677
3908
|
return ''.join(res)
|
|
3678
3909
|
|
|
3679
|
-
def describe_signature(
|
|
3680
|
-
|
|
3910
|
+
def describe_signature(
|
|
3911
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3912
|
+
) -> None:
|
|
3681
3913
|
verify_description_mode(mode)
|
|
3682
3914
|
self.name.describe_signature(signode, mode, env, symbol)
|
|
3683
3915
|
if len(self.attrs) != 0:
|
|
@@ -3694,6 +3926,7 @@ class ASTEnumerator(ASTBase):
|
|
|
3694
3926
|
# Parameters
|
|
3695
3927
|
################################################################################
|
|
3696
3928
|
|
|
3929
|
+
|
|
3697
3930
|
class ASTTemplateParam(ASTBase):
|
|
3698
3931
|
def get_identifier(self) -> ASTIdentifier:
|
|
3699
3932
|
raise NotImplementedError(repr(self))
|
|
@@ -3701,8 +3934,9 @@ class ASTTemplateParam(ASTBase):
|
|
|
3701
3934
|
def get_id(self, version: int) -> str:
|
|
3702
3935
|
raise NotImplementedError(repr(self))
|
|
3703
3936
|
|
|
3704
|
-
def describe_signature(
|
|
3705
|
-
|
|
3937
|
+
def describe_signature(
|
|
3938
|
+
self, parentNode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
3939
|
+
) -> None:
|
|
3706
3940
|
raise NotImplementedError(repr(self))
|
|
3707
3941
|
|
|
3708
3942
|
@property
|
|
@@ -3715,8 +3949,9 @@ class ASTTemplateParam(ASTBase):
|
|
|
3715
3949
|
|
|
3716
3950
|
|
|
3717
3951
|
class ASTTemplateKeyParamPackIdDefault(ASTTemplateParam):
|
|
3718
|
-
def __init__(
|
|
3719
|
-
|
|
3952
|
+
def __init__(
|
|
3953
|
+
self, key: str, identifier: ASTIdentifier, parameterPack: bool, default: ASTType
|
|
3954
|
+
) -> None:
|
|
3720
3955
|
assert key
|
|
3721
3956
|
if parameterPack:
|
|
3722
3957
|
assert default is None
|
|
@@ -3762,12 +3997,12 @@ class ASTTemplateKeyParamPackIdDefault(ASTTemplateParam):
|
|
|
3762
3997
|
res.append(' ')
|
|
3763
3998
|
res.append(transform(self.identifier))
|
|
3764
3999
|
if self.default:
|
|
3765
|
-
res.
|
|
3766
|
-
res.append(transform(self.default))
|
|
4000
|
+
res.extend((' = ', transform(self.default)))
|
|
3767
4001
|
return ''.join(res)
|
|
3768
4002
|
|
|
3769
|
-
def describe_signature(
|
|
3770
|
-
|
|
4003
|
+
def describe_signature(
|
|
4004
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
4005
|
+
) -> None:
|
|
3771
4006
|
signode += addnodes.desc_sig_keyword(self.key, self.key)
|
|
3772
4007
|
if self.parameterPack:
|
|
3773
4008
|
if self.identifier:
|
|
@@ -3810,7 +4045,7 @@ class ASTTemplateParamType(ASTTemplateParam):
|
|
|
3810
4045
|
return self.data.get_identifier()
|
|
3811
4046
|
|
|
3812
4047
|
def get_id(
|
|
3813
|
-
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
4048
|
+
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
3814
4049
|
) -> str:
|
|
3815
4050
|
# this is not part of the normal name mangling in C++
|
|
3816
4051
|
assert version >= 2
|
|
@@ -3823,14 +4058,16 @@ class ASTTemplateParamType(ASTTemplateParam):
|
|
|
3823
4058
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3824
4059
|
return transform(self.data)
|
|
3825
4060
|
|
|
3826
|
-
def describe_signature(
|
|
3827
|
-
|
|
4061
|
+
def describe_signature(
|
|
4062
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
4063
|
+
) -> None:
|
|
3828
4064
|
self.data.describe_signature(signode, mode, env, symbol)
|
|
3829
4065
|
|
|
3830
4066
|
|
|
3831
4067
|
class ASTTemplateParamTemplateType(ASTTemplateParam):
|
|
3832
|
-
def __init__(
|
|
3833
|
-
|
|
4068
|
+
def __init__(
|
|
4069
|
+
self, nestedParams: ASTTemplateParams, data: ASTTemplateKeyParamPackIdDefault
|
|
4070
|
+
) -> None:
|
|
3834
4071
|
assert nestedParams
|
|
3835
4072
|
assert data
|
|
3836
4073
|
self.nestedParams = nestedParams
|
|
@@ -3839,10 +4076,7 @@ class ASTTemplateParamTemplateType(ASTTemplateParam):
|
|
|
3839
4076
|
def __eq__(self, other: object) -> bool:
|
|
3840
4077
|
if not isinstance(other, ASTTemplateParamTemplateType):
|
|
3841
4078
|
return NotImplemented
|
|
3842
|
-
return
|
|
3843
|
-
self.nestedParams == other.nestedParams
|
|
3844
|
-
and self.data == other.data
|
|
3845
|
-
)
|
|
4079
|
+
return self.nestedParams == other.nestedParams and self.data == other.data
|
|
3846
4080
|
|
|
3847
4081
|
def __hash__(self) -> int:
|
|
3848
4082
|
return hash((self.nestedParams, self.data))
|
|
@@ -3860,7 +4094,7 @@ class ASTTemplateParamTemplateType(ASTTemplateParam):
|
|
|
3860
4094
|
return self.data.get_identifier()
|
|
3861
4095
|
|
|
3862
4096
|
def get_id(
|
|
3863
|
-
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
4097
|
+
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
3864
4098
|
) -> str:
|
|
3865
4099
|
assert version >= 2
|
|
3866
4100
|
# this is not part of the normal name mangling in C++
|
|
@@ -3873,17 +4107,20 @@ class ASTTemplateParamTemplateType(ASTTemplateParam):
|
|
|
3873
4107
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3874
4108
|
return transform(self.nestedParams) + transform(self.data)
|
|
3875
4109
|
|
|
3876
|
-
def describe_signature(
|
|
3877
|
-
|
|
4110
|
+
def describe_signature(
|
|
4111
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
4112
|
+
) -> None:
|
|
3878
4113
|
self.nestedParams.describe_signature(signode, 'noneIsName', env, symbol)
|
|
3879
4114
|
signode += addnodes.desc_sig_space()
|
|
3880
4115
|
self.data.describe_signature(signode, mode, env, symbol)
|
|
3881
4116
|
|
|
3882
4117
|
|
|
3883
4118
|
class ASTTemplateParamNonType(ASTTemplateParam):
|
|
3884
|
-
def __init__(
|
|
3885
|
-
|
|
3886
|
-
|
|
4119
|
+
def __init__(
|
|
4120
|
+
self,
|
|
4121
|
+
param: ASTTypeWithInit | ASTTemplateParamConstrainedTypeWithInit,
|
|
4122
|
+
parameterPack: bool = False,
|
|
4123
|
+
) -> None:
|
|
3887
4124
|
assert param
|
|
3888
4125
|
self.param = param
|
|
3889
4126
|
self.parameterPack = parameterPack
|
|
@@ -3891,10 +4128,10 @@ class ASTTemplateParamNonType(ASTTemplateParam):
|
|
|
3891
4128
|
def __eq__(self, other: object) -> bool:
|
|
3892
4129
|
if not isinstance(other, ASTTemplateParamNonType):
|
|
3893
4130
|
return NotImplemented
|
|
3894
|
-
return
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
)
|
|
4131
|
+
return self.param == other.param and self.parameterPack == other.parameterPack
|
|
4132
|
+
|
|
4133
|
+
def __hash__(self) -> int:
|
|
4134
|
+
return hash((self.param, self.parameterPack))
|
|
3898
4135
|
|
|
3899
4136
|
@property
|
|
3900
4137
|
def name(self) -> ASTNestedName:
|
|
@@ -3918,7 +4155,7 @@ class ASTTemplateParamNonType(ASTTemplateParam):
|
|
|
3918
4155
|
return None
|
|
3919
4156
|
|
|
3920
4157
|
def get_id(
|
|
3921
|
-
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
4158
|
+
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
3922
4159
|
) -> str:
|
|
3923
4160
|
assert version >= 2
|
|
3924
4161
|
# this is not part of the normal name mangling in C++
|
|
@@ -3937,16 +4174,18 @@ class ASTTemplateParamNonType(ASTTemplateParam):
|
|
|
3937
4174
|
res += '...'
|
|
3938
4175
|
return res
|
|
3939
4176
|
|
|
3940
|
-
def describe_signature(
|
|
3941
|
-
|
|
4177
|
+
def describe_signature(
|
|
4178
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
4179
|
+
) -> None:
|
|
3942
4180
|
self.param.describe_signature(signode, mode, env, symbol)
|
|
3943
4181
|
if self.parameterPack:
|
|
3944
4182
|
signode += addnodes.desc_sig_punctuation('...', '...')
|
|
3945
4183
|
|
|
3946
4184
|
|
|
3947
4185
|
class ASTTemplateParams(ASTBase):
|
|
3948
|
-
def __init__(
|
|
3949
|
-
|
|
4186
|
+
def __init__(
|
|
4187
|
+
self, params: list[ASTTemplateParam], requiresClause: ASTRequiresClause | None
|
|
4188
|
+
) -> None:
|
|
3950
4189
|
assert params is not None
|
|
3951
4190
|
self.params = params
|
|
3952
4191
|
self.requiresClause = requiresClause
|
|
@@ -3954,33 +4193,36 @@ class ASTTemplateParams(ASTBase):
|
|
|
3954
4193
|
def __eq__(self, other: object) -> bool:
|
|
3955
4194
|
if not isinstance(other, ASTTemplateParams):
|
|
3956
4195
|
return NotImplemented
|
|
3957
|
-
return
|
|
4196
|
+
return (
|
|
4197
|
+
self.params == other.params and self.requiresClause == other.requiresClause
|
|
4198
|
+
)
|
|
3958
4199
|
|
|
3959
4200
|
def __hash__(self) -> int:
|
|
3960
4201
|
return hash((self.params, self.requiresClause))
|
|
3961
4202
|
|
|
3962
4203
|
def get_id(self, version: int, excludeRequires: bool = False) -> str:
|
|
3963
4204
|
assert version >= 2
|
|
3964
|
-
res = []
|
|
3965
|
-
res.append("I")
|
|
4205
|
+
res = ['I']
|
|
3966
4206
|
res.extend(param.get_id(version) for param in self.params)
|
|
3967
|
-
res.append(
|
|
4207
|
+
res.append('E')
|
|
3968
4208
|
if not excludeRequires and self.requiresClause:
|
|
3969
4209
|
res.extend(['IQ', self.requiresClause.expr.get_id(version), 'E'])
|
|
3970
4210
|
return ''.join(res)
|
|
3971
4211
|
|
|
3972
4212
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
3973
|
-
res = []
|
|
3974
|
-
res.
|
|
3975
|
-
|
|
3976
|
-
|
|
4213
|
+
res: list[str] = []
|
|
4214
|
+
res.extend((
|
|
4215
|
+
'template<',
|
|
4216
|
+
', '.join(transform(a) for a in self.params),
|
|
4217
|
+
'> ',
|
|
4218
|
+
))
|
|
3977
4219
|
if self.requiresClause is not None:
|
|
3978
|
-
res.
|
|
3979
|
-
res.append(" ")
|
|
4220
|
+
res.extend((transform(self.requiresClause), ' '))
|
|
3980
4221
|
return ''.join(res)
|
|
3981
4222
|
|
|
3982
|
-
def describe_signature(
|
|
3983
|
-
|
|
4223
|
+
def describe_signature(
|
|
4224
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
4225
|
+
) -> None:
|
|
3984
4226
|
signode += addnodes.desc_sig_keyword('template', 'template')
|
|
3985
4227
|
signode += addnodes.desc_sig_punctuation('<', '<')
|
|
3986
4228
|
first = True
|
|
@@ -3996,38 +4238,45 @@ class ASTTemplateParams(ASTBase):
|
|
|
3996
4238
|
self.requiresClause.describe_signature(signode, mode, env, symbol)
|
|
3997
4239
|
|
|
3998
4240
|
def describe_signature_as_introducer(
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4241
|
+
self,
|
|
4242
|
+
parentNode: desc_signature,
|
|
4243
|
+
mode: str,
|
|
4244
|
+
env: BuildEnvironment,
|
|
4245
|
+
symbol: Symbol,
|
|
4246
|
+
lineSpec: bool,
|
|
4247
|
+
) -> None:
|
|
4248
|
+
def make_line(parent_node: desc_signature) -> addnodes.desc_signature_line:
|
|
4002
4249
|
signode = addnodes.desc_signature_line()
|
|
4003
|
-
|
|
4250
|
+
parent_node += signode
|
|
4004
4251
|
signode.sphinx_line_type = 'templateParams'
|
|
4005
4252
|
return signode
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4253
|
+
|
|
4254
|
+
line_node = make_line(parentNode)
|
|
4255
|
+
line_node += addnodes.desc_sig_keyword('template', 'template')
|
|
4256
|
+
line_node += addnodes.desc_sig_punctuation('<', '<')
|
|
4009
4257
|
first = True
|
|
4010
4258
|
for param in self.params:
|
|
4011
4259
|
if not first:
|
|
4012
|
-
|
|
4013
|
-
|
|
4260
|
+
line_node += addnodes.desc_sig_punctuation(',', ',')
|
|
4261
|
+
line_node += addnodes.desc_sig_space()
|
|
4014
4262
|
first = False
|
|
4015
4263
|
if lineSpec:
|
|
4016
|
-
|
|
4017
|
-
param.describe_signature(
|
|
4264
|
+
line_node = make_line(parentNode)
|
|
4265
|
+
param.describe_signature(line_node, mode, env, symbol)
|
|
4018
4266
|
if lineSpec and not first:
|
|
4019
|
-
|
|
4020
|
-
|
|
4267
|
+
line_node = make_line(parentNode)
|
|
4268
|
+
line_node += addnodes.desc_sig_punctuation('>', '>')
|
|
4021
4269
|
if self.requiresClause:
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
parentNode +=
|
|
4025
|
-
self.requiresClause.describe_signature(
|
|
4270
|
+
req_node = addnodes.desc_signature_line()
|
|
4271
|
+
req_node.sphinx_line_type = 'requiresClause'
|
|
4272
|
+
parentNode += req_node
|
|
4273
|
+
self.requiresClause.describe_signature(req_node, 'markType', env, symbol)
|
|
4026
4274
|
|
|
4027
4275
|
|
|
4028
4276
|
# Template introducers
|
|
4029
4277
|
################################################################################
|
|
4030
4278
|
|
|
4279
|
+
|
|
4031
4280
|
class ASTTemplateIntroductionParameter(ASTBase):
|
|
4032
4281
|
def __init__(self, identifier: ASTIdentifier, parameterPack: bool) -> None:
|
|
4033
4282
|
self.identifier = identifier
|
|
@@ -4057,7 +4306,7 @@ class ASTTemplateIntroductionParameter(ASTBase):
|
|
|
4057
4306
|
return self.identifier
|
|
4058
4307
|
|
|
4059
4308
|
def get_id(
|
|
4060
|
-
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
4309
|
+
self, version: int, objectType: str | None = None, symbol: Symbol | None = None
|
|
4061
4310
|
) -> str:
|
|
4062
4311
|
assert version >= 2
|
|
4063
4312
|
# this is not part of the normal name mangling in C++
|
|
@@ -4086,16 +4335,18 @@ class ASTTemplateIntroductionParameter(ASTBase):
|
|
|
4086
4335
|
res.append(transform(self.identifier))
|
|
4087
4336
|
return ''.join(res)
|
|
4088
4337
|
|
|
4089
|
-
def describe_signature(
|
|
4090
|
-
|
|
4338
|
+
def describe_signature(
|
|
4339
|
+
self, signode: TextElement, mode: str, env: BuildEnvironment, symbol: Symbol
|
|
4340
|
+
) -> None:
|
|
4091
4341
|
if self.parameterPack:
|
|
4092
4342
|
signode += addnodes.desc_sig_punctuation('...', '...')
|
|
4093
4343
|
self.identifier.describe_signature(signode, mode, env, '', '', symbol)
|
|
4094
4344
|
|
|
4095
4345
|
|
|
4096
4346
|
class ASTTemplateIntroduction(ASTBase):
|
|
4097
|
-
def __init__(
|
|
4098
|
-
|
|
4347
|
+
def __init__(
|
|
4348
|
+
self, concept: ASTNestedName, params: list[ASTTemplateIntroductionParameter]
|
|
4349
|
+
) -> None:
|
|
4099
4350
|
assert len(params) > 0
|
|
4100
4351
|
self.concept = concept
|
|
4101
4352
|
self.params = params
|
|
@@ -4112,29 +4363,36 @@ class ASTTemplateIntroduction(ASTBase):
|
|
|
4112
4363
|
assert version >= 2
|
|
4113
4364
|
return ''.join([
|
|
4114
4365
|
# first do the same as a normal template parameter list
|
|
4115
|
-
|
|
4366
|
+
'I',
|
|
4116
4367
|
*(param.get_id(version) for param in self.params),
|
|
4117
|
-
|
|
4368
|
+
'E',
|
|
4118
4369
|
# let's use X expr E, which is otherwise for constant template args
|
|
4119
|
-
|
|
4370
|
+
'X',
|
|
4120
4371
|
self.concept.get_id(version),
|
|
4121
|
-
|
|
4372
|
+
'I',
|
|
4122
4373
|
*(param.get_id_as_arg(version) for param in self.params),
|
|
4123
|
-
|
|
4124
|
-
|
|
4374
|
+
'E',
|
|
4375
|
+
'E',
|
|
4125
4376
|
])
|
|
4126
4377
|
|
|
4127
4378
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
4128
|
-
res = []
|
|
4129
|
-
res.
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4379
|
+
res: list[str] = []
|
|
4380
|
+
res.extend((
|
|
4381
|
+
transform(self.concept),
|
|
4382
|
+
'{',
|
|
4383
|
+
', '.join(transform(param) for param in self.params),
|
|
4384
|
+
'} ',
|
|
4385
|
+
))
|
|
4133
4386
|
return ''.join(res)
|
|
4134
4387
|
|
|
4135
4388
|
def describe_signature_as_introducer(
|
|
4136
|
-
|
|
4137
|
-
|
|
4389
|
+
self,
|
|
4390
|
+
parentNode: desc_signature,
|
|
4391
|
+
mode: str,
|
|
4392
|
+
env: BuildEnvironment,
|
|
4393
|
+
symbol: Symbol,
|
|
4394
|
+
lineSpec: bool,
|
|
4395
|
+
) -> None:
|
|
4138
4396
|
# Note: 'lineSpec' has no effect on template introductions.
|
|
4139
4397
|
signode = addnodes.desc_signature_line()
|
|
4140
4398
|
parentNode += signode
|
|
@@ -4153,9 +4411,11 @@ class ASTTemplateIntroduction(ASTBase):
|
|
|
4153
4411
|
|
|
4154
4412
|
################################################################################
|
|
4155
4413
|
|
|
4414
|
+
|
|
4156
4415
|
class ASTTemplateDeclarationPrefix(ASTBase):
|
|
4157
|
-
def __init__(
|
|
4158
|
-
|
|
4416
|
+
def __init__(
|
|
4417
|
+
self, templates: list[ASTTemplateParams | ASTTemplateIntroduction] | None
|
|
4418
|
+
) -> None:
|
|
4159
4419
|
# templates is None means it's an explicit instantiation of a variable
|
|
4160
4420
|
self.templates = templates
|
|
4161
4421
|
|
|
@@ -4170,19 +4430,19 @@ class ASTTemplateDeclarationPrefix(ASTBase):
|
|
|
4170
4430
|
def get_requires_clause_in_last(self) -> ASTRequiresClause | None:
|
|
4171
4431
|
if self.templates is None:
|
|
4172
4432
|
return None
|
|
4173
|
-
|
|
4174
|
-
if not isinstance(
|
|
4433
|
+
last_list = self.templates[-1]
|
|
4434
|
+
if not isinstance(last_list, ASTTemplateParams):
|
|
4175
4435
|
return None
|
|
4176
|
-
return
|
|
4436
|
+
return last_list.requiresClause # which may be None
|
|
4177
4437
|
|
|
4178
4438
|
def get_id_except_requires_clause_in_last(self, version: int) -> str:
|
|
4179
4439
|
assert version >= 2
|
|
4180
4440
|
# This is not part of the Itanium ABI mangling system.
|
|
4181
4441
|
res = []
|
|
4182
|
-
|
|
4442
|
+
last_index = len(self.templates) - 1
|
|
4183
4443
|
for i, t in enumerate(self.templates):
|
|
4184
4444
|
if isinstance(t, ASTTemplateParams):
|
|
4185
|
-
res.append(t.get_id(version, excludeRequires=(i ==
|
|
4445
|
+
res.append(t.get_id(version, excludeRequires=(i == last_index)))
|
|
4186
4446
|
else:
|
|
4187
4447
|
res.append(t.get_id(version))
|
|
4188
4448
|
return ''.join(res)
|
|
@@ -4190,11 +4450,19 @@ class ASTTemplateDeclarationPrefix(ASTBase):
|
|
|
4190
4450
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
4191
4451
|
return ''.join(map(transform, self.templates))
|
|
4192
4452
|
|
|
4193
|
-
def describe_signature(
|
|
4194
|
-
|
|
4453
|
+
def describe_signature(
|
|
4454
|
+
self,
|
|
4455
|
+
signode: desc_signature,
|
|
4456
|
+
mode: str,
|
|
4457
|
+
env: BuildEnvironment,
|
|
4458
|
+
symbol: Symbol,
|
|
4459
|
+
lineSpec: bool,
|
|
4460
|
+
) -> None:
|
|
4195
4461
|
verify_description_mode(mode)
|
|
4196
4462
|
for t in self.templates:
|
|
4197
|
-
t.describe_signature_as_introducer(
|
|
4463
|
+
t.describe_signature_as_introducer(
|
|
4464
|
+
signode, 'lastIsName', env, symbol, lineSpec
|
|
4465
|
+
)
|
|
4198
4466
|
|
|
4199
4467
|
|
|
4200
4468
|
class ASTRequiresClause(ASTBase):
|
|
@@ -4212,8 +4480,13 @@ class ASTRequiresClause(ASTBase):
|
|
|
4212
4480
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
4213
4481
|
return 'requires ' + transform(self.expr)
|
|
4214
4482
|
|
|
4215
|
-
def describe_signature(
|
|
4216
|
-
|
|
4483
|
+
def describe_signature(
|
|
4484
|
+
self,
|
|
4485
|
+
signode: nodes.TextElement,
|
|
4486
|
+
mode: str,
|
|
4487
|
+
env: BuildEnvironment,
|
|
4488
|
+
symbol: Symbol,
|
|
4489
|
+
) -> None:
|
|
4217
4490
|
signode += addnodes.desc_sig_keyword('requires', 'requires')
|
|
4218
4491
|
signode += addnodes.desc_sig_space()
|
|
4219
4492
|
self.expr.describe_signature(signode, mode, env, symbol)
|
|
@@ -4222,13 +4495,18 @@ class ASTRequiresClause(ASTBase):
|
|
|
4222
4495
|
################################################################################
|
|
4223
4496
|
################################################################################
|
|
4224
4497
|
|
|
4498
|
+
|
|
4225
4499
|
class ASTDeclaration(ASTBase):
|
|
4226
|
-
def __init__(
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4500
|
+
def __init__(
|
|
4501
|
+
self,
|
|
4502
|
+
objectType: str,
|
|
4503
|
+
directiveType: str | None = None,
|
|
4504
|
+
visibility: str | None = None,
|
|
4505
|
+
templatePrefix: ASTTemplateDeclarationPrefix | None = None,
|
|
4506
|
+
declaration: Any = None,
|
|
4507
|
+
trailingRequiresClause: ASTRequiresClause | None = None,
|
|
4508
|
+
semicolon: bool = False,
|
|
4509
|
+
) -> None:
|
|
4232
4510
|
self.objectType = objectType
|
|
4233
4511
|
self.directiveType = directiveType
|
|
4234
4512
|
self.visibility = visibility
|
|
@@ -4260,14 +4538,35 @@ class ASTDeclaration(ASTBase):
|
|
|
4260
4538
|
and self.enumeratorScopedSymbol == other.enumeratorScopedSymbol
|
|
4261
4539
|
)
|
|
4262
4540
|
|
|
4541
|
+
def __hash__(self) -> int:
|
|
4542
|
+
return hash((
|
|
4543
|
+
self.objectType,
|
|
4544
|
+
self.directiveType,
|
|
4545
|
+
self.visibility,
|
|
4546
|
+
self.templatePrefix,
|
|
4547
|
+
self.declaration,
|
|
4548
|
+
self.trailingRequiresClause,
|
|
4549
|
+
self.semicolon,
|
|
4550
|
+
self.symbol,
|
|
4551
|
+
self.enumeratorScopedSymbol,
|
|
4552
|
+
))
|
|
4553
|
+
|
|
4263
4554
|
def clone(self) -> ASTDeclaration:
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4555
|
+
template_prefix_clone = (
|
|
4556
|
+
self.templatePrefix.clone() if self.templatePrefix else None
|
|
4557
|
+
)
|
|
4558
|
+
trailing_requires_clasue_clone = (
|
|
4559
|
+
self.trailingRequiresClause.clone() if self.trailingRequiresClause else None
|
|
4560
|
+
)
|
|
4561
|
+
return ASTDeclaration(
|
|
4562
|
+
self.objectType,
|
|
4563
|
+
self.directiveType,
|
|
4564
|
+
self.visibility,
|
|
4565
|
+
template_prefix_clone,
|
|
4566
|
+
self.declaration.clone(),
|
|
4567
|
+
trailing_requires_clasue_clone,
|
|
4568
|
+
self.semicolon,
|
|
4569
|
+
)
|
|
4271
4570
|
|
|
4272
4571
|
@property
|
|
4273
4572
|
def name(self) -> ASTNestedName:
|
|
@@ -4304,20 +4603,22 @@ class ASTDeclaration(ASTBase):
|
|
|
4304
4603
|
# in the template prefix, and still put it in the end.
|
|
4305
4604
|
# As we now support trailing requires clauses we add that as if it was a conjunction.
|
|
4306
4605
|
if self.templatePrefix is not None:
|
|
4307
|
-
res.append(
|
|
4308
|
-
|
|
4606
|
+
res.append(
|
|
4607
|
+
self.templatePrefix.get_id_except_requires_clause_in_last(version)
|
|
4608
|
+
)
|
|
4609
|
+
requires_clause_in_last = self.templatePrefix.get_requires_clause_in_last()
|
|
4309
4610
|
else:
|
|
4310
|
-
|
|
4611
|
+
requires_clause_in_last = None
|
|
4311
4612
|
|
|
4312
|
-
if
|
|
4613
|
+
if requires_clause_in_last or self.trailingRequiresClause:
|
|
4313
4614
|
if version < 4:
|
|
4314
4615
|
raise NoOldIdError
|
|
4315
4616
|
res.append('IQ')
|
|
4316
|
-
if
|
|
4617
|
+
if requires_clause_in_last and self.trailingRequiresClause:
|
|
4317
4618
|
# make a conjunction of them
|
|
4318
4619
|
res.append('aa')
|
|
4319
|
-
if
|
|
4320
|
-
res.append(
|
|
4620
|
+
if requires_clause_in_last:
|
|
4621
|
+
res.append(requires_clause_in_last.expr.get_id(version))
|
|
4321
4622
|
if self.trailingRequiresClause:
|
|
4322
4623
|
res.append(self.trailingRequiresClause.expr.get_id(version))
|
|
4323
4624
|
res.append('E')
|
|
@@ -4330,88 +4631,101 @@ class ASTDeclaration(ASTBase):
|
|
|
4330
4631
|
return self._newest_id_cache
|
|
4331
4632
|
|
|
4332
4633
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
4333
|
-
res = []
|
|
4334
|
-
if self.visibility and self.visibility !=
|
|
4335
|
-
res.
|
|
4336
|
-
res.append(' ')
|
|
4634
|
+
res: list[str] = []
|
|
4635
|
+
if self.visibility and self.visibility != 'public':
|
|
4636
|
+
res.extend((self.visibility, ' '))
|
|
4337
4637
|
if self.templatePrefix:
|
|
4338
4638
|
res.append(transform(self.templatePrefix))
|
|
4339
4639
|
res.append(transform(self.declaration))
|
|
4340
4640
|
if self.trailingRequiresClause:
|
|
4341
|
-
res.
|
|
4342
|
-
res.append(transform(self.trailingRequiresClause))
|
|
4641
|
+
res.extend((' ', transform(self.trailingRequiresClause)))
|
|
4343
4642
|
if self.semicolon:
|
|
4344
4643
|
res.append(';')
|
|
4345
4644
|
return ''.join(res)
|
|
4346
4645
|
|
|
4347
|
-
def describe_signature(
|
|
4348
|
-
|
|
4646
|
+
def describe_signature(
|
|
4647
|
+
self,
|
|
4648
|
+
signode: desc_signature,
|
|
4649
|
+
mode: str,
|
|
4650
|
+
env: BuildEnvironment,
|
|
4651
|
+
options: dict[str, bool],
|
|
4652
|
+
) -> None:
|
|
4349
4653
|
verify_description_mode(mode)
|
|
4350
4654
|
assert self.symbol
|
|
4351
4655
|
# The caller of the domain added a desc_signature node.
|
|
4352
4656
|
# Always enable multiline:
|
|
4353
4657
|
signode['is_multiline'] = True
|
|
4354
4658
|
# Put each line in a desc_signature_line node.
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4659
|
+
main_decl_node = addnodes.desc_signature_line()
|
|
4660
|
+
main_decl_node.sphinx_line_type = 'declarator'
|
|
4661
|
+
main_decl_node['add_permalink'] = not self.symbol.isRedeclaration
|
|
4358
4662
|
|
|
4359
4663
|
if self.templatePrefix:
|
|
4360
|
-
self.templatePrefix.describe_signature(
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4664
|
+
self.templatePrefix.describe_signature(
|
|
4665
|
+
signode,
|
|
4666
|
+
mode,
|
|
4667
|
+
env,
|
|
4668
|
+
symbol=self.symbol,
|
|
4669
|
+
lineSpec=options.get('tparam-line-spec'),
|
|
4670
|
+
)
|
|
4671
|
+
signode += main_decl_node
|
|
4672
|
+
if self.visibility and self.visibility != 'public':
|
|
4673
|
+
main_decl_node += addnodes.desc_sig_keyword(
|
|
4674
|
+
self.visibility, self.visibility
|
|
4675
|
+
)
|
|
4676
|
+
main_decl_node += addnodes.desc_sig_space()
|
|
4367
4677
|
if self.objectType == 'type':
|
|
4368
4678
|
prefix = self.declaration.get_type_declaration_prefix()
|
|
4369
|
-
|
|
4370
|
-
|
|
4679
|
+
main_decl_node += addnodes.desc_sig_keyword(prefix, prefix)
|
|
4680
|
+
main_decl_node += addnodes.desc_sig_space()
|
|
4371
4681
|
elif self.objectType == 'concept':
|
|
4372
|
-
|
|
4373
|
-
|
|
4682
|
+
main_decl_node += addnodes.desc_sig_keyword('concept', 'concept')
|
|
4683
|
+
main_decl_node += addnodes.desc_sig_space()
|
|
4374
4684
|
elif self.objectType in {'member', 'function'}:
|
|
4375
4685
|
pass
|
|
4376
4686
|
elif self.objectType == 'class':
|
|
4377
|
-
assert self.directiveType in
|
|
4378
|
-
|
|
4379
|
-
|
|
4687
|
+
assert self.directiveType in {'class', 'struct'}
|
|
4688
|
+
main_decl_node += addnodes.desc_sig_keyword(
|
|
4689
|
+
self.directiveType, self.directiveType
|
|
4690
|
+
)
|
|
4691
|
+
main_decl_node += addnodes.desc_sig_space()
|
|
4380
4692
|
elif self.objectType == 'union':
|
|
4381
|
-
|
|
4382
|
-
|
|
4693
|
+
main_decl_node += addnodes.desc_sig_keyword('union', 'union')
|
|
4694
|
+
main_decl_node += addnodes.desc_sig_space()
|
|
4383
4695
|
elif self.objectType == 'enum':
|
|
4384
|
-
|
|
4385
|
-
|
|
4696
|
+
main_decl_node += addnodes.desc_sig_keyword('enum', 'enum')
|
|
4697
|
+
main_decl_node += addnodes.desc_sig_space()
|
|
4386
4698
|
if self.directiveType == 'enum-class':
|
|
4387
|
-
|
|
4388
|
-
|
|
4699
|
+
main_decl_node += addnodes.desc_sig_keyword('class', 'class')
|
|
4700
|
+
main_decl_node += addnodes.desc_sig_space()
|
|
4389
4701
|
elif self.directiveType == 'enum-struct':
|
|
4390
|
-
|
|
4391
|
-
|
|
4702
|
+
main_decl_node += addnodes.desc_sig_keyword('struct', 'struct')
|
|
4703
|
+
main_decl_node += addnodes.desc_sig_space()
|
|
4392
4704
|
else:
|
|
4393
4705
|
assert self.directiveType == 'enum', self.directiveType
|
|
4394
4706
|
elif self.objectType == 'enumerator':
|
|
4395
|
-
|
|
4396
|
-
|
|
4707
|
+
main_decl_node += addnodes.desc_sig_keyword('enumerator', 'enumerator')
|
|
4708
|
+
main_decl_node += addnodes.desc_sig_space()
|
|
4397
4709
|
else:
|
|
4398
4710
|
raise AssertionError(self.objectType)
|
|
4399
|
-
self.declaration.describe_signature(
|
|
4400
|
-
|
|
4711
|
+
self.declaration.describe_signature(main_decl_node, mode, env, self.symbol)
|
|
4712
|
+
last_decl_node = main_decl_node
|
|
4401
4713
|
if self.trailingRequiresClause:
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
signode.append(
|
|
4405
|
-
|
|
4714
|
+
trailing_req_node = addnodes.desc_signature_line()
|
|
4715
|
+
trailing_req_node.sphinx_line_type = 'trailingRequiresClause'
|
|
4716
|
+
signode.append(trailing_req_node)
|
|
4717
|
+
last_decl_node = trailing_req_node
|
|
4406
4718
|
self.trailingRequiresClause.describe_signature(
|
|
4407
|
-
|
|
4719
|
+
trailing_req_node, 'markType', env, self.symbol
|
|
4720
|
+
)
|
|
4408
4721
|
if self.semicolon:
|
|
4409
|
-
|
|
4722
|
+
last_decl_node += addnodes.desc_sig_punctuation(';', ';')
|
|
4410
4723
|
|
|
4411
4724
|
|
|
4412
4725
|
class ASTNamespace(ASTBase):
|
|
4413
|
-
def __init__(
|
|
4414
|
-
|
|
4726
|
+
def __init__(
|
|
4727
|
+
self, nestedName: ASTNestedName, templatePrefix: ASTTemplateDeclarationPrefix
|
|
4728
|
+
) -> None:
|
|
4415
4729
|
self.nestedName = nestedName
|
|
4416
4730
|
self.templatePrefix = templatePrefix
|
|
4417
4731
|
|
|
@@ -4423,6 +4737,9 @@ class ASTNamespace(ASTBase):
|
|
|
4423
4737
|
and self.templatePrefix == other.templatePrefix
|
|
4424
4738
|
)
|
|
4425
4739
|
|
|
4740
|
+
def __hash__(self) -> int:
|
|
4741
|
+
return hash((self.nestedName, self.templatePrefix))
|
|
4742
|
+
|
|
4426
4743
|
def _stringify(self, transform: StringifyTransform) -> str:
|
|
4427
4744
|
res = []
|
|
4428
4745
|
if self.templatePrefix:
|