We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 85464f6 commit 1c43468Copy full SHA for 1c43468
1 file changed
ast_/ast.py
@@ -57,9 +57,13 @@ def generic_visit(node: Ast):
57
def filter_inorder(self, node, filter_func: Callable[[Any], bool]):
58
""" Visit the tree inorder, but only those that return true for filter
59
"""
60
+ visited = set()
61
stack = [node]
62
while stack:
63
node = stack.pop()
64
+ if node in visited:
65
+ continue
66
+ visited.add(node)
67
if filter_func(node):
68
yield self.visit(node)
69
elif isinstance(node, Ast):
0 commit comments