1
1
from __future__ import annotations
2
2
3
- from typing import TYPE_CHECKING , Any , Callable
3
+ from typing import TYPE_CHECKING , Any , Callable , ValuesView
4
4
5
5
from sphinx .domains .c ._ast import (
6
6
ASTDeclaration ,
@@ -117,8 +117,8 @@ def __init__(
117
117
self ._add_function_params ()
118
118
119
119
@property
120
- def _children (self ) -> Sequence [Symbol ]:
121
- return list ( self ._childrenByName .values () )
120
+ def _children (self ) -> ValuesView [Symbol ]:
121
+ return self ._childrenByName .values ()
122
122
123
123
def _add_child (self , child : Symbol ) -> None :
124
124
name = child .ident .name
@@ -134,7 +134,7 @@ def _remove_child(self, child: Symbol) -> None:
134
134
self ._childrenByName .pop (name )
135
135
siblings = self ._childrenByDocname .get (child .docname , {})
136
136
if name in siblings :
137
- siblings . pop ( name )
137
+ del siblings [ name ]
138
138
if child .ident .is_anon () and child in self ._anonChildren :
139
139
self ._anonChildren .remove (child )
140
140
@@ -187,7 +187,9 @@ def clear_doc(self, docname: str) -> None:
187
187
for child in self ._children :
188
188
child .clear_doc (docname )
189
189
return
190
- for sChild in self ._childrenByDocname [docname ].values ():
190
+
191
+ children : dict [str , Symbol ] = self ._childrenByDocname .pop (docname )
192
+ for sChild in children .values ():
191
193
sChild .declaration = None
192
194
sChild .docname = None
193
195
sChild .line = None
@@ -197,9 +199,7 @@ def clear_doc(self, docname: str) -> None:
197
199
sChild .siblingBelow .siblingAbove = sChild .siblingAbove
198
200
sChild .siblingAbove = None
199
201
sChild .siblingBelow = None
200
-
201
202
self ._remove_child (sChild )
202
- del self ._childrenByDocname [docname ]
203
203
204
204
def get_all_symbols (self ) -> Iterator [Symbol ]:
205
205
yield self
0 commit comments