1.1 --- a/optimiser.py Thu Oct 20 22:43:48 2016 +0200
1.2 +++ b/optimiser.py Thu Oct 20 23:40:02 2016 +0200
1.3 @@ -506,15 +506,38 @@
1.4
1.5 remaining -= 1
1.6
1.7 + # Define or emit the means of accessing the actual target.
1.8 +
1.9 if final_method == "static-assign":
1.10 - emit(("__store_member", origin, "<assexpr>"))
1.11 + parent, attrname = origin.rsplit(".", 1)
1.12 + emit(("__store_via_object", parent, attrname, "<assexpr>"))
1.13 +
1.14 elif final_method == "static":
1.15 accessor = ("__load_static", origin)
1.16
1.17 + elif final_method == "static-invoke":
1.18 + kind = self.importer.get_object(origin).get_kind()
1.19 + accessor = ("__encode_callable", origin, kind)
1.20 +
1.21 + # Wrap accesses in context operations.
1.22 +
1.23 if context_test == "test":
1.24 emit(("__test_context", context_var, accessor))
1.25 +
1.26 elif context_test == "replace":
1.27 - emit(("__replace_context", context_var, accessor))
1.28 +
1.29 + # Static invocation targets have a context added but no other
1.30 + # transformation performed.
1.31 +
1.32 + if final_method == "static-invoke":
1.33 + emit(("__update_context", context_var, accessor))
1.34 +
1.35 + # Other invocation targets gain a context and have the bound
1.36 + # version of the callable activated.
1.37 +
1.38 + else:
1.39 + emit(("__replace_context", context_var, accessor))
1.40 +
1.41 elif final_method not in ("assign", "static-assign"):
1.42 emit(accessor)
1.43