mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #7960 from jakobandersen/c_deepcopy
C, don't deepcopy as deep on handling enumerators
This commit is contained in:
commit
a4494e87b0
3
CHANGES
3
CHANGES
@ -16,6 +16,9 @@ Features added
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
* C, don't deepcopy the entire symbol table and make a mess every time an
|
||||
enumerator is handled.
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
||||
|
@ -1330,6 +1330,10 @@ class ASTDeclaration(ASTBaseBase):
|
||||
# set by CObject._add_enumerator_to_parent
|
||||
self.enumeratorScopedSymbol = None # type: Symbol
|
||||
|
||||
def clone(self) -> "ASTDeclaration":
|
||||
return ASTDeclaration(self.objectType, self.directiveType,
|
||||
self.declaration.clone(), self.semicolon)
|
||||
|
||||
@property
|
||||
def name(self) -> ASTNestedName:
|
||||
return self.declaration.name
|
||||
@ -1419,6 +1423,16 @@ class Symbol:
|
||||
debug_lookup = False
|
||||
debug_show_tree = False
|
||||
|
||||
def __copy__(self):
|
||||
assert False # shouldn't happen
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
if self.parent:
|
||||
assert False # shouldn't happen
|
||||
else:
|
||||
# the domain base class makes a copy of the initial data, which is fine
|
||||
return Symbol(None, None, None, None)
|
||||
|
||||
@staticmethod
|
||||
def debug_print(*args: Any) -> None:
|
||||
print(Symbol.debug_indent_string * Symbol.debug_indent, end="")
|
||||
|
@ -3781,6 +3781,16 @@ class Symbol:
|
||||
debug_lookup = False # overridden by the corresponding config value
|
||||
debug_show_tree = False # overridden by the corresponding config value
|
||||
|
||||
def __copy__(self):
|
||||
assert False # shouldn't happen
|
||||
|
||||
def __deepcopy__(self, memo):
|
||||
if self.parent:
|
||||
assert False # shouldn't happen
|
||||
else:
|
||||
# the domain base class makes a copy of the initial data, which is fine
|
||||
return Symbol(None, None, None, None, None, None)
|
||||
|
||||
@staticmethod
|
||||
def debug_print(*args: Any) -> None:
|
||||
print(Symbol.debug_indent_string * Symbol.debug_indent, end="")
|
||||
|
@ -110,7 +110,6 @@ class ASTBaseBase:
|
||||
__hash__ = None # type: Callable[[], int]
|
||||
|
||||
def clone(self) -> Any:
|
||||
"""Clone a definition expression node."""
|
||||
return deepcopy(self)
|
||||
|
||||
def _stringify(self, transform: StringifyTransform) -> str:
|
||||
|
Loading…
Reference in New Issue
Block a user