1.1 --- a/deducer.py Fri Oct 14 23:17:51 2016 +0200
1.2 +++ b/deducer.py Fri Oct 14 23:24:51 2016 +0200
1.3 @@ -1927,7 +1927,10 @@
1.4
1.5 # Determine the nature of the context.
1.6
1.7 - context = len(traversed + remaining) == 1 and (base and "base" or "original-accessor") or "final-accessor"
1.8 + context = is_assignment and "unset" or \
1.9 + len(traversed + remaining) == 1 and \
1.10 + (base and "base" or "original-accessor") or \
1.11 + "final-accessor"
1.12
1.13 return name, test, test_type, base, traversed, traversal_modes, remaining, context, first_method, final_method, origin
1.14
2.1 --- a/optimiser.py Fri Oct 14 23:17:51 2016 +0200
2.2 +++ b/optimiser.py Fri Oct 14 23:24:51 2016 +0200
2.3 @@ -373,19 +373,17 @@
2.4 assigning = not traversed and not attrnames and final_method == "assign"
2.5
2.6 # Set the context if already available.
2.7 +
2.8 + if context == "original-accessor":
2.9 + emit(("set_context", original_accessor))
2.10 + accessor = "context"
2.11 + elif context == "base":
2.12 + emit(("set_context", base))
2.13 + accessor = "context"
2.14 +
2.15 # Assigning does not set the context.
2.16
2.17 - if not assigning:
2.18 - if context == "original-accessor":
2.19 - emit(("set_context", original_accessor))
2.20 - accessor = "context"
2.21 - elif context == "base":
2.22 - emit(("set_context", base))
2.23 - accessor = "context"
2.24 - elif context == "final-accessor" or access_first_attribute:
2.25 - emit(("set_accessor", original_accessor))
2.26 - accessor = "accessor"
2.27 - else:
2.28 + elif context in ("final-accessor", "unset"):
2.29 emit(("set_accessor", original_accessor))
2.30 accessor = "accessor"
2.31