1.1 --- a/encoders.py Sat Feb 18 20:13:47 2017 +0100
1.2 +++ b/encoders.py Sat Feb 18 20:20:06 2017 +0100
1.3 @@ -207,7 +207,7 @@
1.4 )
1.5
1.6 static_ops = (
1.7 - "__load_static_ignore", "__load_static_replace", "__load_static_test",
1.8 + "__load_static_ignore", "__load_static_replace", "__load_static_test", "<test_context_static>",
1.9 )
1.10
1.11 context_values = (
1.12 @@ -215,7 +215,7 @@
1.13 )
1.14
1.15 context_ops = (
1.16 - "<context>", "<set_context>", "<test_context>",
1.17 + "<context>", "<set_context>", "<test_context>", "<test_context_static>",
1.18 )
1.19
1.20 reference_acting_ops = attribute_ops + checked_ops + typename_ops
1.21 @@ -286,7 +286,7 @@
1.22
1.23 # Add context storage information to certain operations.
1.24
1.25 - elif op in context_ops:
1.26 + if op in context_ops:
1.27 a.insert(0, context_index)
1.28
1.29 # Define any argument string.
2.1 --- a/optimiser.py Sat Feb 18 20:13:47 2017 +0100
2.2 +++ b/optimiser.py Sat Feb 18 20:20:06 2017 +0100
2.3 @@ -531,8 +531,10 @@
2.4 # Wrap accesses in context operations.
2.5
2.6 if context_test == "test":
2.7 - if final_method in ("static", "static-invoke"):
2.8 + if final_method == "static":
2.9 emit(("__load_static_test", context_var, origin))
2.10 + elif final_method == "static-invoke":
2.11 + emit(("<test_context_static>", context_var, origin))
2.12 elif final_method == "access-invoke":
2.13 emit(("<test_context>", context_var, accessor))
2.14 else:
3.1 --- a/templates/ops.h Sat Feb 18 20:13:47 2017 +0100
3.2 +++ b/templates/ops.h Sat Feb 18 20:20:06 2017 +0100
3.3 @@ -77,6 +77,10 @@
3.4 #define __test_context_set(__TARGET, __CONTEXT, __ATTR) \
3.5 (__test_context_update(__CONTEXT, __ATTR) ? (__set_context(__TARGET, (__attr) {.value=__CONTEXT}), __ATTR) : __ATTR)
3.6
3.7 +#define __test_context_static(__TARGET, __CONTEXT, __REF) \
3.8 + (__test_context_update(__CONTEXT, (__attr) {.value=__REF}) ? \
3.9 + (__set_context(__TARGET, (__attr) {.value=__CONTEXT}), (__attr) {.value=__REF}) : (__attr) {.value=__REF})
3.10 +
3.11 #define __get_context(__TARGET) (__tmp_contexts[__TARGET])
3.12 #define __set_context(__TARGET, __ATTR) (__tmp_contexts[__TARGET] = (__ATTR).value)
3.13 #define __set_private_context(__ATTR) (__tmp_private_context = (__ATTR).value)
4.1 --- a/translator.py Sat Feb 18 20:13:47 2017 +0100
4.2 +++ b/translator.py Sat Feb 18 20:20:06 2017 +0100
4.3 @@ -790,6 +790,7 @@
4.4
4.5 "<context>" : "__tmp_contexts",
4.6 "<test_context>" : "__tmp_contexts",
4.7 + "<test_context_static>" : "__tmp_contexts",
4.8 "<set_context>" : "__tmp_contexts",
4.9 "<set_private_context>" : "__tmp_private_context",
4.10 "<set_accessor>" : "__tmp_value",
4.11 @@ -799,6 +800,7 @@
4.12 self.op_subs = {
4.13 "<context>" : "__get_context",
4.14 "<test_context>" : "__test_context_set",
4.15 + "<test_context_static>" : "__test_context_static",
4.16 "<set_context>" : "__set_context",
4.17 "<set_private_context>" : "__set_private_context",
4.18 "<set_accessor>" : "__set_accessor",