# HG changeset patch # User Paul Boddie # Date 1481762190 -3600 # Node ID 7fcbb79569d8df8e54dfd1f2ff588a19f53b04be # Parent 06d7f3b0dcc60f20832cdc1437e0a678f9c95a17 Access method defaults even if the accessor is not yet determined. diff -r 06d7f3b0dcc6 -r 7fcbb79569d8 translator.py --- a/translator.py Wed Dec 14 17:22:07 2016 +0100 +++ b/translator.py Thu Dec 15 01:36:30 2016 +0100 @@ -199,7 +199,7 @@ return self.accessor_kinds def __repr__(self): - return "AttrResult(%r, %r)" % (self.s, self.get_origin()) + return "AttrResult(%r, %r, %r)" % (self.s, self.refs, self.accessor_kinds) class PredefinedConstantRef(AttrResult): @@ -1077,6 +1077,7 @@ expr = self.process_structure_node(n.node) objpath = expr.get_origin() target = None + target_structure = None function = None instantiation = False literal_instantiation = False @@ -1112,20 +1113,23 @@ # Test for functions and methods. - method_class = self.is_method(objpath) + context_required = self.is_method(objpath) accessor_kinds = expr.get_accessor_kinds() instance_accessor = accessor_kinds and \ len(accessor_kinds) == 1 and \ first(accessor_kinds) == "" - if not method_class or instance_accessor: + # Only identify certain bound methods or functions. + + if not context_required or instance_accessor: target = encode_function_pointer(objpath) - target_structure = self.is_method(objpath) and \ - "&%s" % encode_bound_reference(objpath) or \ - "&%s" % encode_path(objpath) - - if not method_class: - context_required = False + + # Access bound method defaults even if it is not clear whether + # the accessor is appropriate. + + target_structure = self.is_method(objpath) and \ + "&%s" % encode_bound_reference(objpath) or \ + "&%s" % encode_path(objpath) # Other targets are retrieved at run-time.