# HG changeset patch # User Paul Boddie # Date 1480118160 -3600 # Node ID 399732ba1e063b1f2c5da7c60125f3581c74c122 # Parent 9957ac5894b40b5840e05dd3e0f5f144dca630a9 Support direct access to known callables when function pointers cannot be used. diff -r 9957ac5894b4 -r 399732ba1e06 translator.py --- a/translator.py Fri Nov 25 22:02:58 2016 +0100 +++ b/translator.py Sat Nov 26 00:56:00 2016 +0100 @@ -938,6 +938,7 @@ expr = self.process_structure_node(n.node) objpath = expr.get_origin() target = None + function = None literal_instantiation = False # Obtain details of the callable. @@ -963,6 +964,7 @@ # Only plain functions and bound methods employ function pointers. elif expr.has_kind(""): + function = objpath # Test for functions and methods. @@ -1070,10 +1072,13 @@ if target: stages.append(target) + elif function: + stages.append("__load_via_object(&%s, %s).fn" % ( + encode_path(function), encode_symbol("pos", "__fn__"))) # With a known target, the function is obtained directly and called. - if target: + if target or function: output = "(\n%s\n)(%s)" % (",\n".join(stages), argstr) # With unknown targets, the generic invocation function is applied to