# HG changeset patch # User Paul Boddie # Date 1531401953 -7200 # Node ID b8314380f391b3e1ec2dbeae71de6ff9759f5da9 # Parent 81587921b9b4d486a285a2a9df61e5142fffe961 Revert changeset 838:00fd67211882 because identified contexts are not tested for suitability with invocations, as illustrated by the methods_unbound test. diff -r 81587921b9b4 -r b8314380f391 translator.py --- a/translator.py Wed Jul 11 23:53:09 2018 +0200 +++ b/translator.py Thu Jul 12 15:25:53 2018 +0200 @@ -1252,11 +1252,13 @@ if context_required: if have_access_context: - args = [context_identity] + context_arg = context_identity else: - args = ["__CONTEXT_AS_VALUE(%s)" % target_var] + context_arg = "__CONTEXT_AS_VALUE(%s)" % target_var else: - args = ["__NULL"] + context_arg = "__NULL" + + args = [context_arg] # Complete the array with null values, permitting tests for a complete # set of arguments. @@ -1398,25 +1400,23 @@ elif function: if context_required: - # With context_verified or context_identity... - - if have_access_context: + # Avoid further context testing if appropriate. + + if have_access_context and context_verified: emit("__get_function_member(%s)" % target_expr) # Otherwise, test the context for the function/method. else: - emit("__get_function(__CONTEXT_AS_VALUE(%s), %s)" % ( - target_var, target_expr)) + emit("__get_function(%s, %s)" % (context_arg, target_expr)) else: emit("_get_function_member(%s)" % target_expr) # With known parameters, the target can be tested. elif known_parameters: - context_arg = context_required and args[0] or "__NULL" if self.always_callable(refs): - if context_verified or context_identity: + if context_verified: emit("__get_function_member(%s)" % target_expr) else: emit("__get_function(%s, %s)" % (context_arg, target_expr))