1.1 --- a/translator.py Mon Feb 27 14:44:30 2017 +0100
1.2 +++ b/translator.py Mon Feb 27 14:52:11 2017 +0100
1.3 @@ -154,7 +154,7 @@
1.4 elif static_name:
1.5 parent = ref.parent()
1.6 context = ref.has_kind("<function>") and encode_path(parent) or None
1.7 - return "((__attr) {.value=&%s})" % static_name
1.8 + return "__ATTRVALUE(&%s)" % static_name
1.9
1.10 # Qualified names must be converted into parent-relative accesses.
1.11
1.12 @@ -938,9 +938,8 @@
1.13 ref = self.importer.identify(class_name)
1.14
1.15 if not ref.static():
1.16 - self.process_assignment_for_object(
1.17 - n.name, make_expression("((__attr) {.value=&%s})" %
1.18 - encode_path(class_name)))
1.19 + self.process_assignment_for_object(n.name,
1.20 + make_expression("__ATTRVALUE(&%s)" % encode_path(class_name)))
1.21
1.22 self.enter_namespace(n.name)
1.23
1.24 @@ -1118,7 +1117,7 @@
1.25 context = self.is_method(objpath)
1.26
1.27 self.process_assignment_for_object(original_name,
1.28 - make_expression("((__attr) {.value=&%s})" % encode_path(objpath)))
1.29 + make_expression("__ATTRVALUE(&%s)" % encode_path(objpath)))
1.30
1.31 def process_function_defaults(self, n, name, objpath, instance_name=None):
1.32
1.33 @@ -1327,7 +1326,7 @@
1.34
1.35 if context_required:
1.36 if have_access_context:
1.37 - args = ["(__attr) {.value=%s}" % context_identity]
1.38 + args = ["__ATTRVALUE(%s)" % context_identity]
1.39 else:
1.40 args = ["__CONTEXT_AS_VALUE(%s)" % target_var]
1.41 else:
1.42 @@ -1509,14 +1508,14 @@
1.43 # Without defaults, produce an attribute referring to the function.
1.44
1.45 if not defaults:
1.46 - return make_expression("((__attr) {.value=&%s})" % encode_path(function_name))
1.47 + return make_expression("__ATTRVALUE(&%s)" % encode_path(function_name))
1.48
1.49 # With defaults, copy the function structure and set the defaults on the
1.50 # copy.
1.51
1.52 else:
1.53 self.record_temp("__tmp_value")
1.54 - return make_expression("(__tmp_value = __COPY(&%s, sizeof(%s)), %s, (__attr) {.value=__tmp_value})" % (
1.55 + return make_expression("(__tmp_value = __COPY(&%s, sizeof(%s)), %s, __ATTRVALUE(__tmp_value))" % (
1.56 encode_path(function_name),
1.57 encode_symbol("obj", function_name),
1.58 ", ".join(defaults)))