1.1 --- a/deducer.py Sat Sep 02 22:08:53 2023 +0200
1.2 +++ b/deducer.py Sun Sep 03 00:24:29 2023 +0200
1.3 @@ -2907,6 +2907,12 @@
1.4 elif final_method in ("static", "static-invoke"):
1.5 accessor = ("__load_static_ignore", origin)
1.6
1.7 + # Define any replacement context variable plus the default eventual
1.8 + # context variable.
1.9 +
1.10 + replacement_context_var = "<new_context>"
1.11 + final_context_var = context_var
1.12 +
1.13 # Wrap accesses in context operations.
1.14
1.15 if context_test == "test":
1.16 @@ -2914,7 +2920,8 @@
1.17 # Test and combine the context with static attribute details.
1.18
1.19 if final_method == "static":
1.20 - emit(("__load_static_test", context_var, origin))
1.21 + emit(("__load_static_test", replacement_context_var, context_var, origin))
1.22 + final_context_var = replacement_context_var
1.23
1.24 # Test the context, storing it separately if required for the
1.25 # immediately invoked static attribute.
1.26 @@ -2932,14 +2939,16 @@
1.27 # appropriate.
1.28
1.29 else:
1.30 - emit(("__test_context", context_var, accessor))
1.31 + emit(("__test_context", replacement_context_var, context_var, accessor))
1.32 + final_context_var = replacement_context_var
1.33
1.34 elif context_test == "replace":
1.35
1.36 # Produce an object with updated context.
1.37
1.38 if final_method == "static":
1.39 - emit(("__load_static_replace", context_var, origin))
1.40 + emit(("__load_static_replace", replacement_context_var, context_var, origin))
1.41 + final_context_var = replacement_context_var
1.42
1.43 # Omit the context update operation where the target is static
1.44 # and the context is recorded separately.
1.45 @@ -2956,7 +2965,8 @@
1.46 # Update the context in the attribute details.
1.47
1.48 else:
1.49 - emit(("__update_context", context_var, accessor))
1.50 + emit(("__update_context", replacement_context_var, context_var, accessor))
1.51 + final_context_var = replacement_context_var
1.52
1.53 # Omit the accessor for assignments and for invocations of static
1.54 # targets. Otherwise, emit the accessor which may involve the
1.55 @@ -2967,7 +2977,7 @@
1.56
1.57 # Produce an advisory instruction regarding the context.
1.58
1.59 - if context_var:
1.60 + if final_context_var:
1.61
1.62 # Only verify the context for invocation purposes if a suitable
1.63 # test has been performed.
1.64 @@ -2975,9 +2985,9 @@
1.65 if context_test in ("ignore", "replace") or \
1.66 final_method in ("access-invoke", "static-invoke"):
1.67
1.68 - emit(("<context_identity_verified>", context_var))
1.69 + emit(("<context_identity_verified>", final_context_var))
1.70 else:
1.71 - emit(("<context_identity>", context_var))
1.72 + emit(("<context_identity>", final_context_var))
1.73
1.74 # Produce an advisory instruction regarding the final attribute.
1.75