1.1 --- a/translator.py Wed Dec 14 17:22:07 2016 +0100
1.2 +++ b/translator.py Thu Dec 15 01:36:30 2016 +0100
1.3 @@ -199,7 +199,7 @@
1.4 return self.accessor_kinds
1.5
1.6 def __repr__(self):
1.7 - return "AttrResult(%r, %r)" % (self.s, self.get_origin())
1.8 + return "AttrResult(%r, %r, %r)" % (self.s, self.refs, self.accessor_kinds)
1.9
1.10 class PredefinedConstantRef(AttrResult):
1.11
1.12 @@ -1077,6 +1077,7 @@
1.13 expr = self.process_structure_node(n.node)
1.14 objpath = expr.get_origin()
1.15 target = None
1.16 + target_structure = None
1.17 function = None
1.18 instantiation = False
1.19 literal_instantiation = False
1.20 @@ -1112,20 +1113,23 @@
1.21
1.22 # Test for functions and methods.
1.23
1.24 - method_class = self.is_method(objpath)
1.25 + context_required = self.is_method(objpath)
1.26 accessor_kinds = expr.get_accessor_kinds()
1.27 instance_accessor = accessor_kinds and \
1.28 len(accessor_kinds) == 1 and \
1.29 first(accessor_kinds) == "<instance>"
1.30
1.31 - if not method_class or instance_accessor:
1.32 + # Only identify certain bound methods or functions.
1.33 +
1.34 + if not context_required or instance_accessor:
1.35 target = encode_function_pointer(objpath)
1.36 - target_structure = self.is_method(objpath) and \
1.37 - "&%s" % encode_bound_reference(objpath) or \
1.38 - "&%s" % encode_path(objpath)
1.39 -
1.40 - if not method_class:
1.41 - context_required = False
1.42 +
1.43 + # Access bound method defaults even if it is not clear whether
1.44 + # the accessor is appropriate.
1.45 +
1.46 + target_structure = self.is_method(objpath) and \
1.47 + "&%s" % encode_bound_reference(objpath) or \
1.48 + "&%s" % encode_path(objpath)
1.49
1.50 # Other targets are retrieved at run-time.
1.51