Lichen

Change of translator.py

851:b8314380f391
translator.py
     1.1 --- a/translator.py	Wed Jul 11 23:53:09 2018 +0200
     1.2 +++ b/translator.py	Thu Jul 12 15:25:53 2018 +0200
     1.3 @@ -1252,11 +1252,13 @@
     1.4  
     1.5          if context_required:
     1.6              if have_access_context:
     1.7 -                args = [context_identity]
     1.8 +                context_arg = context_identity
     1.9              else:
    1.10 -                args = ["__CONTEXT_AS_VALUE(%s)" % target_var]
    1.11 +                context_arg = "__CONTEXT_AS_VALUE(%s)" % target_var
    1.12          else:
    1.13 -            args = ["__NULL"]
    1.14 +            context_arg = "__NULL"
    1.15 +
    1.16 +        args = [context_arg]
    1.17  
    1.18          # Complete the array with null values, permitting tests for a complete
    1.19          # set of arguments.
    1.20 @@ -1398,25 +1400,23 @@
    1.21          elif function:
    1.22              if context_required:
    1.23  
    1.24 -                # With context_verified or context_identity...
    1.25 -
    1.26 -                if have_access_context:
    1.27 +                # Avoid further context testing if appropriate.
    1.28 +
    1.29 +                if have_access_context and context_verified:
    1.30                      emit("__get_function_member(%s)" % target_expr)
    1.31  
    1.32                  # Otherwise, test the context for the function/method.
    1.33  
    1.34                  else:
    1.35 -                    emit("__get_function(__CONTEXT_AS_VALUE(%s), %s)" % (
    1.36 -                        target_var, target_expr))
    1.37 +                    emit("__get_function(%s, %s)" % (context_arg, target_expr))
    1.38              else:
    1.39                  emit("_get_function_member(%s)" % target_expr)
    1.40  
    1.41          # With known parameters, the target can be tested.
    1.42  
    1.43          elif known_parameters:
    1.44 -            context_arg = context_required and args[0] or "__NULL"
    1.45              if self.always_callable(refs):
    1.46 -                if context_verified or context_identity:
    1.47 +                if context_verified:
    1.48                      emit("__get_function_member(%s)" % target_expr)
    1.49                  else:
    1.50                      emit("__get_function(%s, %s)" % (context_arg, target_expr))