1.1 --- a/inspector.py Wed Feb 08 01:21:39 2017 +0100
1.2 +++ b/inspector.py Wed Feb 08 16:20:27 2017 +0100
1.3 @@ -438,7 +438,8 @@
1.4 # Record attribute usage in the tracker, and record the branch
1.5 # information for the access.
1.6
1.7 - branches = tracker.use_attribute(name, attrname, self.in_invocation is not None, assignment)
1.8 + branches = tracker.use_attribute(name, attrname,
1.9 + self.in_invocation is not None, assignment)
1.10
1.11 if not branches:
1.12 raise InspectError("Name %s is accessed using %s before an assignment." % (
1.13 @@ -742,22 +743,29 @@
1.14 self.allocate_arguments(path, n.args)
1.15
1.16 try:
1.17 + in_invocation = self.in_invocation
1.18 + self.in_invocation = None
1.19 +
1.20 + # Process the arguments.
1.21 +
1.22 + keywords = set()
1.23 +
1.24 + for arg in n.args:
1.25 + self.process_structure_node(arg)
1.26 + if isinstance(arg, compiler.ast.Keyword):
1.27 + keywords.add(arg.name)
1.28 +
1.29 + keywords = list(keywords)
1.30 + keywords.sort()
1.31 +
1.32 # Communicate to the invocation target expression that it forms the
1.33 # target of an invocation, potentially affecting attribute accesses.
1.34
1.35 - in_invocation = self.in_invocation
1.36 - self.in_invocation = len(n.args)
1.37 + self.in_invocation = len(n.args), keywords
1.38
1.39 # Process the expression, obtaining any identified reference.
1.40
1.41 name_ref = self.process_structure_node(n.node)
1.42 - self.in_invocation = None
1.43 -
1.44 - # Process the arguments.
1.45 -
1.46 - for arg in n.args:
1.47 - self.process_structure_node(arg)
1.48 -
1.49 self.in_invocation = in_invocation
1.50
1.51 # Detect class invocations.