From 05811c7c1b9eca16526b4292b4ab00b086c1664a Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 8 Jun 2014 17:05:40 -0400 Subject: [PATCH] Fix bug in parser for Python classes. --- bitshift/parser/python.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitshift/parser/python.py b/bitshift/parser/python.py index d7ac108..4cecfc4 100644 --- a/bitshift/parser/python.py +++ b/bitshift/parser/python.py @@ -134,7 +134,9 @@ class _CachedWalker(ast.NodeVisitor): start_line, start_col, end_line, end_col = self.block_position(node) pos = (start_line, start_col, end_line, end_col) - self.accum['classes'][node.name] = pos + if node.name not in self.accum['classes']: + self.accum['classes'][node.name] = {'assignments': [], 'uses': []} + self.accum['classes'][node.name]['assignments'].append(pos) self.generic_visit(node)