1.1 --- a/encoders.py Tue Mar 21 18:45:42 2017 +0100
1.2 +++ b/encoders.py Thu Mar 23 16:40:57 2017 +0100
1.3 @@ -237,9 +237,13 @@
1.4 "<test_context_revert>", "<test_context_static>",
1.5 )
1.6
1.7 -reference_acting_ops = attribute_ops + checked_ops + typename_ops
1.8 +reference_acting_ops = attribute_ops + checked_ops + type_ops + typename_ops
1.9 attribute_producing_ops = attribute_loading_ops + checked_loading_ops
1.10
1.11 +attribute_producing_variables = (
1.12 + "<accessor>", "<context>", "<name>", "<private_context>", "<target_accessor>"
1.13 + )
1.14 +
1.15 def encode_access_instruction(instruction, subs, context_index):
1.16
1.17 """
1.18 @@ -340,13 +344,7 @@
1.19
1.20 if isinstance(arg, tuple):
1.21 encoded, substituted = encode_access_instruction(arg, subs, context_index)
1.22 -
1.23 - # Convert attribute results to references where required.
1.24 -
1.25 - if op and op in reference_acting_ops and arg[0] in attribute_producing_ops:
1.26 - return "%s.value" % encoded, substituted
1.27 - else:
1.28 - return encoded, substituted
1.29 + return attribute_to_reference(op, arg[0], encoded, substituted)
1.30
1.31 # Special values only need replacing, not encoding.
1.32
1.33 @@ -355,13 +353,18 @@
1.34 # Handle values modified by storage details.
1.35
1.36 if arg in context_values:
1.37 - return "%s(%s)" % (subs.get(arg), context_index), set([arg])
1.38 + encoded = "%s(%s)" % (subs.get(arg), context_index)
1.39 else:
1.40 - return subs.get(arg), set([arg])
1.41 + encoded = subs.get(arg)
1.42 +
1.43 + substituted = set([arg])
1.44 + return attribute_to_reference(op, arg, encoded, substituted)
1.45
1.46 # Convert static references to the appropriate type.
1.47
1.48 - elif op and op in reference_acting_ops and arg != "<accessor>":
1.49 + elif op and op in reference_acting_ops and \
1.50 + arg not in attribute_producing_variables:
1.51 +
1.52 return "&%s" % encode_path(arg), set()
1.53
1.54 # Other values may need encoding.
1.55 @@ -369,6 +372,18 @@
1.56 else:
1.57 return encode_path(arg), set()
1.58
1.59 +def attribute_to_reference(op, arg, encoded, substituted):
1.60 +
1.61 + # Convert attribute results to references where required.
1.62 +
1.63 + if op and op in reference_acting_ops and (
1.64 + arg in attribute_producing_ops or
1.65 + arg in attribute_producing_variables):
1.66 +
1.67 + return "__VALUE(%s)" % encoded, substituted
1.68 + else:
1.69 + return encoded, substituted
1.70 +
1.71 def encode_function_pointer(path):
1.72
1.73 "Encode 'path' as a reference to an output program function."
2.1 --- a/templates/native/introspection.c Tue Mar 21 18:45:42 2017 +0100
2.2 +++ b/templates/native/introspection.c Thu Mar 23 16:40:57 2017 +0100
2.3 @@ -51,7 +51,7 @@
2.4
2.5 /* Update the context to the object if it is a method. */
2.6
2.7 - return __update_context(obj->value, out);
2.8 + return __update_context(*obj, out);
2.9 }
2.10
2.11 return out;
3.1 --- a/templates/native/program.c Tue Mar 21 18:45:42 2017 +0100
3.2 +++ b/templates/native/program.c Thu Mar 23 16:40:57 2017 +0100
3.3 @@ -31,7 +31,7 @@
3.4 __attr * const callable = &__args[1];
3.5 __attr * const instance = &__args[2];
3.6
3.7 - return __test_context(instance->value, *callable);
3.8 + return __test_context(*instance, *callable);
3.9 }
3.10
3.11 /* Module initialisation. */
4.1 --- a/templates/ops.c Tue Mar 21 18:45:42 2017 +0100
4.2 +++ b/templates/ops.c Thu Mar 23 16:40:57 2017 +0100
4.3 @@ -23,6 +23,13 @@
4.4 #include "progconsts.h"
4.5 #include "progtypes.h"
4.6
4.7 +/* Get object reference from attribute. */
4.8 +
4.9 +__ref __VALUE(__attr attr)
4.10 +{
4.11 + return attr.value;
4.12 +}
4.13 +
4.14 /* Basic structure tests. */
4.15
4.16 static inline int __HASATTR(__ref obj, int pos, int code)
4.17 @@ -37,12 +44,12 @@
4.18 return __ATTRVALUE(obj);
4.19 }
4.20
4.21 -__attr __load_static_replace(__ref context, __ref obj)
4.22 +__attr __load_static_replace(__attr context, __ref obj)
4.23 {
4.24 return __update_context(context, __ATTRVALUE(obj));
4.25 }
4.26
4.27 -__attr __load_static_test(__ref context, __ref obj)
4.28 +__attr __load_static_test(__attr context, __ref obj)
4.29 {
4.30 return __test_context(context, __ATTRVALUE(obj));
4.31 }
4.32 @@ -92,12 +99,12 @@
4.33
4.34 int __is_subclass(__ref obj, __attr cls)
4.35 {
4.36 - return __HASATTR(obj, __TYPEPOS(cls.value), __TYPECODE(cls.value));
4.37 + return __HASATTR(obj, __TYPEPOS(__VALUE(cls)), __TYPECODE(__VALUE(cls)));
4.38 }
4.39
4.40 int __is_instance_subclass(__ref obj, __attr cls)
4.41 {
4.42 - return __is_instance(obj) && __HASATTR(__get_class(obj), __TYPEPOS(cls.value), __TYPECODE(cls.value));
4.43 + return __is_instance(obj) && __HASATTR(__get_class(obj), __TYPEPOS(__VALUE(cls)), __TYPECODE(__VALUE(cls)));
4.44 }
4.45
4.46 int __is_type_instance(__ref obj)
4.47 @@ -107,7 +114,7 @@
4.48
4.49 __ref __get_class(__ref obj)
4.50 {
4.51 - return __load_via_object(obj, __class__).value;
4.52 + return __VALUE(__load_via_object(obj, __class__));
4.53 }
4.54
4.55 __attr __get_class_attr(__ref obj)
4.56 @@ -174,7 +181,7 @@
4.57 __attr __check_and_load_via_any__(__ref obj, int pos, int code)
4.58 {
4.59 __attr out = __check_and_load_via_object_null(obj, pos, code);
4.60 - if (out.value == 0)
4.61 + if (__ISNULL(out))
4.62 out = __check_and_load_via_class__(obj, pos, code);
4.63 return out;
4.64 }
4.65 @@ -216,27 +223,28 @@
4.66
4.67 /* Context-related operations. */
4.68
4.69 -int __test_context_update(__ref context, __attr attr)
4.70 +int __test_context_update(__attr context, __attr attr)
4.71 {
4.72 /* Return whether the context should be updated for the attribute. */
4.73
4.74 - __ref attrcontext = __CONTEXT_AS_VALUE(attr).value;
4.75 + __attr attrcontext = __CONTEXT_AS_VALUE(attr);
4.76 + __ref attrcontextvalue = __VALUE(attrcontext);
4.77
4.78 /* Preserve any existing null or instance context. */
4.79
4.80 - if ((attrcontext == 0) || __is_instance(attrcontext))
4.81 + if (__ISNULL(attrcontext) || __is_instance(attrcontextvalue))
4.82 return 0;
4.83
4.84 /* Test any instance context against the context employed by the
4.85 attribute. */
4.86
4.87 - if (__is_instance(context))
4.88 + if (__is_instance(__VALUE(context)))
4.89 {
4.90 /* Obtain the special class attribute position and code identifying the
4.91 attribute context's class, inspecting the context instance for
4.92 compatibility. */
4.93
4.94 - if (__test_common_instance__(context, __TYPEPOS(attrcontext), __TYPECODE(attrcontext)))
4.95 + if (__test_common_instance__(__VALUE(context), __TYPEPOS(attrcontextvalue), __TYPECODE(attrcontextvalue)))
4.96 return 1;
4.97 else
4.98 __raise_type_error();
4.99 @@ -244,7 +252,7 @@
4.100
4.101 /* Test for access to a type class attribute using a type instance. */
4.102
4.103 - if (__test_specific_type(attrcontext, &__TYPE_CLASS_TYPE) && __is_type_instance(context))
4.104 + if (__test_specific_type(attrcontextvalue, &__TYPE_CLASS_TYPE) && __is_type_instance(__VALUE(context)))
4.105 return 1;
4.106
4.107 /* Otherwise, preserve the attribute as retrieved. */
4.108 @@ -252,7 +260,7 @@
4.109 return 0;
4.110 }
4.111
4.112 -__attr __test_context(__ref context, __attr attr)
4.113 +__attr __test_context(__attr context, __attr attr)
4.114 {
4.115 /* Update the context or return the unchanged attribute. */
4.116
4.117 @@ -262,22 +270,22 @@
4.118 return attr;
4.119 }
4.120
4.121 -__attr __update_context(__ref context, __attr attr)
4.122 +__attr __update_context(__attr context, __attr attr)
4.123 {
4.124 return __new_wrapper(context, attr);
4.125 }
4.126
4.127 -__attr __test_context_revert(int target, __ref context, __attr attr, __ref contexts[])
4.128 +__attr __test_context_revert(int target, __attr context, __attr attr, __attr contexts[])
4.129 {
4.130 /* Revert the local context to that employed by the attribute if the
4.131 supplied context is not appropriate. */
4.132
4.133 if (!__test_context_update(context, attr))
4.134 - contexts[target] = __CONTEXT_AS_VALUE(attr).value;
4.135 + contexts[target] = __CONTEXT_AS_VALUE(attr);
4.136 return attr;
4.137 }
4.138
4.139 -__attr __test_context_static(int target, __ref context, __ref value, __ref contexts[])
4.140 +__attr __test_context_static(int target, __attr context, __ref value, __attr contexts[])
4.141 {
4.142 /* Set the local context to the specified context if appropriate. */
4.143
4.144 @@ -288,53 +296,53 @@
4.145
4.146 /* Context testing for invocations. */
4.147
4.148 -int __type_method_invocation(__ref context, __attr target)
4.149 +int __type_method_invocation(__attr context, __attr target)
4.150 {
4.151 - __ref targetcontext = __CONTEXT_AS_VALUE(target).value;
4.152 + __attr targetcontext = __CONTEXT_AS_VALUE(target);
4.153
4.154 /* Require instances, not classes, where methods are function instances. */
4.155
4.156 - if (!__is_instance(target.value))
4.157 + if (!__is_instance(__VALUE(target)))
4.158 return 0;
4.159
4.160 /* Access the context of the callable and test if it is the type object. */
4.161
4.162 - return ((targetcontext != 0) && __test_specific_type(targetcontext, &__TYPE_CLASS_TYPE) && __is_type_instance(context));
4.163 + return (!__ISNULL(targetcontext) && __test_specific_type(__VALUE(targetcontext), &__TYPE_CLASS_TYPE) && __is_type_instance(__VALUE(context)));
4.164 }
4.165
4.166 __attr __unwrap_callable(__attr callable)
4.167 {
4.168 - __attr value = __check_and_load_via_object_null(callable.value, __ATTRPOS(__value__), __ATTRCODE(__value__));
4.169 - return value.value ? value : callable;
4.170 + __attr value = __check_and_load_via_object_null(__VALUE(callable), __ATTRPOS(__value__), __ATTRCODE(__value__));
4.171 + return __VALUE(value) ? value : callable;
4.172 }
4.173
4.174 __attr (*__get_function_unchecked(__attr target))(__attr[])
4.175 {
4.176 - return __load_via_object(__unwrap_callable(target).value, __fn__).fn;
4.177 + return __load_via_object(__VALUE(__unwrap_callable(target)), __fn__).fn;
4.178 }
4.179
4.180 -__attr (*__get_function(__ref context, __attr target))(__attr[])
4.181 +__attr (*__get_function(__attr context, __attr target))(__attr[])
4.182 {
4.183 target = __unwrap_callable(target);
4.184
4.185 /* Require null or instance contexts for functions and methods respectively,
4.186 or type instance contexts for type methods. */
4.187
4.188 - if ((context == 0) || __is_instance(context) || __type_method_invocation(context, target))
4.189 - return __load_via_object(target.value, __fn__).fn;
4.190 + if (__ISNULL(context) || __is_instance(__VALUE(context)) || __type_method_invocation(context, target))
4.191 + return __load_via_object(__VALUE(target), __fn__).fn;
4.192 else
4.193 return __unbound_method;
4.194 }
4.195
4.196 -__attr (*__check_and_get_function(__ref context, __attr target))(__attr[])
4.197 +__attr (*__check_and_get_function(__attr context, __attr target))(__attr[])
4.198 {
4.199 target = __unwrap_callable(target);
4.200
4.201 /* Require null or instance contexts for functions and methods respectively,
4.202 or type instance contexts for type methods. */
4.203
4.204 - if ((context == 0) || __is_instance(context) || __type_method_invocation(context, target))
4.205 - return __check_and_load_via_object__(target.value, __ATTRPOS(__fn__), __ATTRCODE(__fn__)).fn;
4.206 + if (__ISNULL(context) || __is_instance(__VALUE(context)) || __type_method_invocation(context, target))
4.207 + return __check_and_load_via_object__(__VALUE(target), __ATTRPOS(__fn__), __ATTRCODE(__fn__)).fn;
4.208 else
4.209 return __unbound_method;
4.210 }
4.211 @@ -359,7 +367,7 @@
4.212
4.213 __attr __CONTEXT_AS_VALUE(__attr attr)
4.214 {
4.215 - return __check_and_load_via_object_null(attr.value, __ATTRPOS(__context__), __ATTRCODE(__context__));
4.216 + return __check_and_load_via_object_null(__VALUE(attr), __ATTRPOS(__context__), __ATTRCODE(__context__));
4.217 }
4.218
4.219 /* Type testing. */
5.1 --- a/templates/ops.h Tue Mar 21 18:45:42 2017 +0100
5.2 +++ b/templates/ops.h Thu Mar 23 16:40:57 2017 +0100
5.3 @@ -22,11 +22,15 @@
5.4 #include "types.h"
5.5 #include <string.h> /* for __COPY */
5.6
5.7 +/* Get object reference from attribute. */
5.8 +
5.9 +__ref __VALUE(__attr attr);
5.10 +
5.11 /* Direct access and manipulation of static objects. */
5.12
5.13 __attr __load_static_ignore(__ref obj);
5.14 -__attr __load_static_replace(__ref context, __ref obj);
5.15 -__attr __load_static_test(__ref context, __ref obj);
5.16 +__attr __load_static_replace(__attr context, __ref obj);
5.17 +__attr __load_static_test(__attr context, __ref obj);
5.18
5.19 /* Direct retrieval operations, returning attributes. */
5.20
5.21 @@ -93,24 +97,24 @@
5.22
5.23 /* Context-related operations. */
5.24
5.25 -int __test_context_update(__ref context, __attr attr);
5.26 -__attr __test_context(__ref context, __attr attr);
5.27 -__attr __update_context(__ref context, __attr attr);
5.28 -__attr __test_context_revert(int target, __ref context, __attr attr, __ref contexts[]);
5.29 -__attr __test_context_static(int target, __ref context, __ref value, __ref contexts[]);
5.30 +int __test_context_update(__attr context, __attr attr);
5.31 +__attr __test_context(__attr context, __attr attr);
5.32 +__attr __update_context(__attr context, __attr attr);
5.33 +__attr __test_context_revert(int target, __attr context, __attr attr, __attr contexts[]);
5.34 +__attr __test_context_static(int target, __attr context, __ref value, __attr contexts[]);
5.35
5.36 #define __get_context(__TARGET) (__tmp_contexts[__TARGET])
5.37 -#define __set_context(__TARGET, __ATTR) (__tmp_contexts[__TARGET] = (__ATTR).value)
5.38 -#define __set_private_context(__ATTR) (__tmp_private_context = (__ATTR).value)
5.39 -#define __set_accessor(__ATTR) (__tmp_value = (__ATTR).value)
5.40 -#define __set_target_accessor(__ATTR) (__tmp_target_value = (__ATTR).value)
5.41 +#define __set_context(__TARGET, __ATTR) (__tmp_contexts[__TARGET] = (__ATTR))
5.42 +#define __set_private_context(__ATTR) (__tmp_private_context = (__ATTR))
5.43 +#define __set_accessor(__ATTR) (__tmp_value = (__ATTR))
5.44 +#define __set_target_accessor(__ATTR) (__tmp_target_value = (__ATTR))
5.45
5.46 /* Context testing for invocations. */
5.47
5.48 __attr __unwrap_callable(__attr callable);
5.49 __attr (*__get_function_unchecked(__attr target))(__attr[]);
5.50 -__attr (*__get_function(__ref context, __attr target))(__attr[]);
5.51 -__attr (*__check_and_get_function(__ref context, __attr target))(__attr[]);
5.52 +__attr (*__get_function(__attr context, __attr target))(__attr[]);
5.53 +__attr (*__check_and_get_function(__attr context, __attr target))(__attr[]);
5.54
5.55 /* Parameter position operations. */
5.56
6.1 --- a/templates/progops.c Tue Mar 21 18:45:42 2017 +0100
6.2 +++ b/templates/progops.c Thu Mar 23 16:40:57 2017 +0100
6.3 @@ -32,13 +32,13 @@
6.4 __ref obj = (__ref) (immutable ? __ALLOCATEIM : __ALLOCATE)(1, size);
6.5 obj->table = table;
6.6 obj->pos = __INSTANCEPOS;
6.7 - __store_via_object(obj, __class__, (__attr) {.value=cls});
6.8 - return (__attr) {.value=obj};
6.9 + __store_via_object(obj, __class__, __ATTRVALUE(cls));
6.10 + return __ATTRVALUE(obj);
6.11 }
6.12
6.13 -__attr __new_wrapper(__ref context, __attr attr)
6.14 +__attr __new_wrapper(__attr context, __attr attr)
6.15 {
6.16 - return __new___builtins___core_wrapper((__attr[]) {__NULL, {.value=context}, attr});
6.17 + return __new___builtins___core_wrapper((__attr[]) {__NULL, context, attr});
6.18 }
6.19
6.20 /* Generic internal data allocation. */
6.21 @@ -163,7 +163,7 @@
6.22
6.23 /* Return instances as provided. */
6.24
6.25 - if (__is_instance(arg.value))
6.26 + if (__is_instance(__VALUE(arg)))
6.27 return arg;
6.28
6.29 /* Invoke non-instances to produce instances. */
6.30 @@ -192,7 +192,7 @@
6.31 /* Obtain the __args__ special member, referencing the parameter table. */
6.32 /* Refer to the table and minimum/maximum. */
6.33
6.34 - const __ptable *ptable = __check_and_load_via_object(target.value, __args__).ptable;
6.35 + const __ptable *ptable = __check_and_load_via_object(__VALUE(target), __args__).ptable;
6.36 const unsigned int min = ptable->min, max = ptable->max;
6.37
6.38 /* Reserve enough space for the arguments. */
6.39 @@ -247,13 +247,13 @@
6.40 for (pos = nargs; pos < max; pos++)
6.41 {
6.42 if (allargs[pos].value == 0)
6.43 - allargs[pos] = __GETDEFAULT(target.value, pos - min);
6.44 + allargs[pos] = __GETDEFAULT(__VALUE(target), pos - min);
6.45 }
6.46 }
6.47
6.48 /* Call with the prepared arguments. */
6.49
6.50 - return (always_callable ? __get_function(allargs[0].value, target) : __check_and_get_function(allargs[0].value, target))(allargs);
6.51 + return (always_callable ? __get_function(allargs[0], target) : __check_and_get_function(allargs[0], target))(allargs);
6.52 }
6.53
6.54 /* Error routines. */
6.55 @@ -281,9 +281,10 @@
6.56 int __BOOL(__attr attr)
6.57 {
6.58 __attr args[2] = {__NULL, attr};
6.59 + __ref truevalue = __VALUE(__builtins___boolean_True);
6.60
6.61 /* Invoke the bool function with the object and test against True. */
6.62
6.63 - return (attr.value == __builtins___boolean_True.value) ||
6.64 - (__fn___builtins___boolean_bool(args).value == __builtins___boolean_True.value);
6.65 + return (__VALUE(attr) == truevalue) ||
6.66 + (__VALUE(__fn___builtins___boolean_bool(args)) == truevalue);
6.67 }
7.1 --- a/templates/progops.h Tue Mar 21 18:45:42 2017 +0100
7.2 +++ b/templates/progops.h Thu Mar 23 16:40:57 2017 +0100
7.3 @@ -25,7 +25,7 @@
7.4 /* Generic instantiation operations, defining common members. */
7.5
7.6 __attr __new(const __table *table, __ref cls, size_t size, int immutable);
7.7 -__attr __new_wrapper(__ref context, __attr attr);
7.8 +__attr __new_wrapper(__attr context, __attr attr);
7.9
7.10 /* Generic internal data allocation. */
7.11
8.1 --- a/translator.py Tue Mar 21 18:45:42 2017 +0100
8.2 +++ b/translator.py Thu Mar 23 16:40:57 2017 +0100
8.3 @@ -542,7 +542,7 @@
8.4
8.5 subs = {
8.6 "<expr>" : attr_expr,
8.7 - "<name>" : "%s.value" % attr_expr,
8.8 + "<name>" : attr_expr,
8.9 "<assexpr>" : self.in_assignment,
8.10 }
8.11
8.12 @@ -884,16 +884,25 @@
8.13
8.14 # Produce an appropriate access to an attribute's value.
8.15
8.16 - parameters = self.importer.function_parameters.get(self.get_namespace_path())
8.17 - if parameters and name in parameters:
8.18 - name_to_value = "%s->value" % encode_path(name)
8.19 - else:
8.20 - name_to_value = "%s.value" % encode_path(name)
8.21 + name_as_attr = self.get_name_as_attribute(name)
8.22
8.23 # Write a test that raises a TypeError upon failure.
8.24
8.25 - self.writestmt("if (!__test_%s_%s(%s, %s)) __raise_type_error();" % (
8.26 - guard, guard_type, name_to_value, argstr))
8.27 + self.writestmt("if (!__test_%s_%s(__VALUE(%s), %s)) __raise_type_error();" % (
8.28 + guard, guard_type, name_as_attr, argstr))
8.29 +
8.30 + def get_name_as_attribute(self, name):
8.31 +
8.32 + "Return a generated expression for 'name' yielding an attribute."
8.33 +
8.34 + parameters = self.importer.function_parameters.get(self.get_namespace_path())
8.35 + parameter = name == "self" and self.in_method() or \
8.36 + parameters and name in parameters
8.37 +
8.38 + if parameter:
8.39 + return "*%s" % encode_path(name)
8.40 + else:
8.41 + return "%s" % encode_path(name)
8.42
8.43 def process_function_node(self, n):
8.44
8.45 @@ -963,6 +972,8 @@
8.46
8.47 if not instance_name:
8.48 instance_name = "&%s" % encode_path(objpath)
8.49 + else:
8.50 + instance_name = "__VALUE(%s)" % instance_name
8.51
8.52 # Where defaults are involved but cannot be identified, obtain a new
8.53 # instance of the lambda and populate the defaults.
8.54 @@ -1199,8 +1210,9 @@
8.55 if not target_identity:
8.56 self.record_temp("__tmp_targets")
8.57
8.58 - if context_identity and context_identity.startswith("__tmp_contexts"):
8.59 - self.record_temp("__tmp_contexts")
8.60 + if context_identity:
8.61 + if context_identity.startswith("__tmp_contexts"):
8.62 + self.record_temp("__tmp_contexts")
8.63
8.64 # Arguments are presented in a temporary frame array with any context
8.65 # always being the first argument. Where it would be unused, it may be
8.66 @@ -1210,7 +1222,7 @@
8.67
8.68 if context_required:
8.69 if have_access_context:
8.70 - args = ["__ATTRVALUE(%s)" % context_identity]
8.71 + args = [context_identity]
8.72 else:
8.73 args = ["__CONTEXT_AS_VALUE(%s)" % context_var]
8.74 else:
8.75 @@ -1355,19 +1367,19 @@
8.76 stages.append("__get_function(%s, %s)" % (
8.77 context_identity, target_var))
8.78 else:
8.79 - stages.append("__get_function(__CONTEXT_AS_VALUE(%s).value, %s)" % (
8.80 + stages.append("__get_function(__CONTEXT_AS_VALUE(%s), %s)" % (
8.81 context_var, target_var))
8.82 else:
8.83 - stages.append("__load_via_object(%s.value, __fn__).fn" % target_var)
8.84 + stages.append("__load_via_object(__VALUE(%s), __fn__).fn" % target_var)
8.85
8.86 # With known parameters, the target can be tested.
8.87
8.88 elif known_parameters:
8.89 context_arg = context_required and args[0] or "__NULL"
8.90 if self.always_callable(refs):
8.91 - stages.append("__get_function(%s.value, %s)" % (context_arg, target_var))
8.92 + stages.append("__get_function(%s, %s)" % (context_arg, target_var))
8.93 else:
8.94 - stages.append("__check_and_get_function(%s.value, %s)" % (context_arg, target_var))
8.95 + stages.append("__check_and_get_function(%s, %s)" % (context_arg, target_var))
8.96
8.97 # With a known target, the function is obtained directly and called.
8.98 # By putting the invocation at the end of the final element in the
8.99 @@ -1467,7 +1479,7 @@
8.100
8.101 else:
8.102 self.record_temp("__tmp_value")
8.103 - return make_expression("(__tmp_value = __COPY(&%s, sizeof(%s)), %s, __ATTRVALUE(__tmp_value))" % (
8.104 + return make_expression("(__tmp_value = __ATTRVALUE(__COPY(&%s, sizeof(%s))), %s, __tmp_value)" % (
8.105 encode_path(function_name),
8.106 encode_symbol("obj", function_name),
8.107 ", ".join(defaults)))
8.108 @@ -2018,16 +2030,16 @@
8.109 if self.uses_temp(name, "__tmp_targets"):
8.110 self.writeline("__attr __tmp_targets[%d];" % targets)
8.111 if self.uses_temp(name, "__tmp_contexts"):
8.112 - self.writeline("__ref __tmp_contexts[%d];" % targets)
8.113 + self.writeline("__attr __tmp_contexts[%d];" % targets)
8.114
8.115 # Add temporary variable usage details.
8.116
8.117 if self.uses_temp(name, "__tmp_private_context"):
8.118 - self.writeline("__ref __tmp_private_context;")
8.119 + self.writeline("__attr __tmp_private_context;")
8.120 if self.uses_temp(name, "__tmp_value"):
8.121 - self.writeline("__ref __tmp_value;")
8.122 + self.writeline("__attr __tmp_value;")
8.123 if self.uses_temp(name, "__tmp_target_value"):
8.124 - self.writeline("__ref __tmp_target_value;")
8.125 + self.writeline("__attr __tmp_target_value;")
8.126 if self.uses_temp(name, "__tmp_result"):
8.127 self.writeline("__attr __tmp_result;")
8.128