summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/btm_matcher.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib2to3/btm_matcher.py')
-rw-r--r--Lib/lib2to3/btm_matcher.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/lib2to3/btm_matcher.py b/Lib/lib2to3/btm_matcher.py
index 3b78868..736ba2b 100644
--- a/Lib/lib2to3/btm_matcher.py
+++ b/Lib/lib2to3/btm_matcher.py
@@ -104,7 +104,7 @@ class BottomMatcher(object):
current_ast_node.was_checked = True
for child in current_ast_node.children:
# multiple statements, recheck
- if isinstance(child, pytree.Leaf) and child.value == ";":
+ if isinstance(child, pytree.Leaf) and child.value == u";":
current_ast_node.was_checked = False
break
if current_ast_node.type == 1:
@@ -117,7 +117,10 @@ class BottomMatcher(object):
#token matches
current_ac_node = current_ac_node.transition_table[node_token]
for fixer in current_ac_node.fixers:
+ if not fixer in results:
+ results[fixer] = []
results[fixer].append(current_ast_node)
+
else:
#matching failed, reset automaton
current_ac_node = self.root
@@ -131,6 +134,8 @@ class BottomMatcher(object):
#token matches
current_ac_node = current_ac_node.transition_table[node_token]
for fixer in current_ac_node.fixers:
+ if not fixer in results.keys():
+ results[fixer] = []
results[fixer].append(current_ast_node)
current_ast_node = current_ast_node.parent