1.1 --- a/inspector.py Fri Oct 07 21:36:08 2016 +0200
1.2 +++ b/inspector.py Sat Oct 08 00:33:32 2016 +0200
1.3 @@ -43,6 +43,7 @@
1.4
1.5 self.in_class = False
1.6 self.in_conditional = False
1.7 + self.in_invocation = False
1.8 self.global_attr_accesses = {}
1.9
1.10 # Usage tracking.
1.11 @@ -363,7 +364,11 @@
1.12
1.13 # Obtain any completed chain and return the reference to it.
1.14
1.15 + in_invocation = self.in_invocation
1.16 + self.in_invocation = False
1.17 name_ref = self.process_attribute_chain(n)
1.18 + self.in_invocation = in_invocation
1.19 +
1.20 if self.have_access_expression(n):
1.21 return name_ref
1.22
1.23 @@ -440,7 +445,7 @@
1.24 # Record attribute usage in the tracker, and record the branch
1.25 # information for the access.
1.26
1.27 - branches = tracker.use_attribute(name, attrname)
1.28 + branches = tracker.use_attribute(name, attrname, self.in_invocation)
1.29
1.30 if not branches:
1.31 raise InspectError("Name %s is accessed using %s before an assignment." % (
1.32 @@ -707,7 +712,10 @@
1.33 try:
1.34 # Process the expression, obtaining any identified reference.
1.35
1.36 + in_invocation = self.in_invocation
1.37 + self.in_invocation = True
1.38 name_ref = self.process_structure_node(n.node)
1.39 + self.in_invocation = in_invocation
1.40
1.41 # Process the arguments.
1.42