1.1 --- a/common.py Sun Feb 12 23:23:28 2017 +0100
1.2 +++ b/common.py Sun Feb 19 17:31:31 2017 +0100
1.3 @@ -741,14 +741,14 @@
1.4
1.5 return isinstance(node.expr, compiler.ast.Getattr)
1.6
1.7 - def get_name_for_tracking(self, name, path=None):
1.8 + def get_name_for_tracking(self, name, ref=None):
1.9
1.10 """
1.11 Return the name to be used for attribute usage observations involving
1.12 - the given 'name' in the current namespace. If 'path' is indicated and
1.13 - the name is being used outside a function, return the path value;
1.14 - otherwise, return a path computed using the current namespace and the
1.15 - given name.
1.16 + the given 'name' in the current namespace. If 'ref' is indicated and
1.17 + the name is being used outside a function, return the origin information
1.18 + from 'ref'; otherwise, return a path computed using the current
1.19 + namespace and the given name.
1.20
1.21 The intention of this method is to provide a suitably-qualified name
1.22 that can be tracked across namespaces. Where globals are being
1.23 @@ -768,8 +768,13 @@
1.24
1.25 # For static namespaces, use the given qualified name.
1.26
1.27 - elif path:
1.28 - return path
1.29 + elif ref and ref.static():
1.30 + return ref.get_origin()
1.31 +
1.32 + # For non-static objects in static namespaces, use any alias.
1.33 +
1.34 + elif ref and ref.get_name():
1.35 + return ref.get_name()
1.36
1.37 # Otherwise, establish a name in the current namespace.
1.38