Skip to content

Commit 8e09eed

Browse files
authored
Merge pull request #27 from vindex10/feature/class_allow_annassign
allow annassigns for instance variables of a class
2 parents 7592a20 + 4690d15 commit 8e09eed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python/asthelper.py

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ def visit_Assign(self, node):
5555
ac.visit(target)
5656
self.attributes |= ac.data
5757

58+
def visit_AnnAssign(self, node):
59+
ac = AttributeCollector(self.instance_name)
60+
ac.visit(node.target)
61+
self.attributes |= ac.data
62+
5863

5964
class MethodVisitor(ast.NodeVisitor):
6065
"""Gathers information about a method

0 commit comments

Comments
 (0)