Lichen

Changeset

829:a8a16ef13733
2018-06-24 Paul Boddie raw files shortlog changelog graph Simplify the logic around target usage for invocation contexts.
translator.py (file)
     1.1 --- a/translator.py	Sun Jun 24 00:09:33 2018 +0200
     1.2 +++ b/translator.py	Sun Jun 24 00:57:47 2018 +0200
     1.3 @@ -1234,16 +1234,14 @@
     1.4          # An expression featuring an accessor test.
     1.5  
     1.6          need_target_stored = defaults_target_var and not target_identity or \
     1.7 -                             need_context_target and not target_named or \
     1.8 +                             need_context_target and not target_identity or \
     1.9                               need_context_stored or \
    1.10                               tests_accessor and not target
    1.11  
    1.12          # Define stored target details.
    1.13  
    1.14          target_stored = "__tmp_targets[%d]" % self.function_target
    1.15 -
    1.16          target_var = need_target_stored and target_stored or target_identity
    1.17 -        context_var = need_target_stored and target_stored or target_named
    1.18  
    1.19          if need_target_stored:
    1.20              self.record_temp("__tmp_targets")
    1.21 @@ -1259,7 +1257,7 @@
    1.22              if have_access_context:
    1.23                  args = [context_identity]
    1.24              else:
    1.25 -                args = ["__CONTEXT_AS_VALUE(%s)" % context_var]
    1.26 +                args = ["__CONTEXT_AS_VALUE(%s)" % target_var]
    1.27          else:
    1.28              args = ["__NULL"]
    1.29  
    1.30 @@ -1410,7 +1408,7 @@
    1.31                              context_identity, target_expr))
    1.32                  else:
    1.33                      emit("__get_function(__CONTEXT_AS_VALUE(%s), %s)" % (
    1.34 -                        context_var, target_expr))
    1.35 +                        target_var, target_expr))
    1.36              else:
    1.37                  emit("_get_function_member(%s)" % target_expr)
    1.38