Skip to content

Commit

Permalink
Merge pull request #536 from edreamleo/ekr-walk3
Browse files Browse the repository at this point in the history
Clean the walk function in rope.base.ast
  • Loading branch information
lieryan committed Nov 27, 2022
2 parents f47a05e + 2e4d9b7 commit 48ad2f8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rope/base/ast.py
Expand Up @@ -22,7 +22,7 @@ def parse(source, filename="<string>"):
raise error


def walk(node, walker):
def walk(node, walker) -> None:
"""Walk the syntax tree"""
method_name = "_" + node.__class__.__name__
method = getattr(walker, method_name, None)
Expand All @@ -31,7 +31,8 @@ def walk(node, walker):
# In python < 2.7 ``node.module == ''`` for relative imports
# but for python 2.7 it is None. Generalizing it to ''.
node.module = ""
return method(node)
method(node)
return
for child in get_child_nodes(node):
walk(child, walker)

Expand Down

0 comments on commit 48ad2f8

Please sign in to comment.