1.1 --- a/translator.py Tue Oct 25 23:10:29 2016 +0200
1.2 +++ b/translator.py Tue Oct 25 23:53:04 2016 +0200
1.3 @@ -84,8 +84,10 @@
1.4 # usable directly. For targets, no constant should be assigned and thus
1.5 # the alias (or any plain name) will be used.
1.6
1.7 - origin = self.static() and self.get_origin()
1.8 - name = origin and encode_path(origin) or name and encode_path(name) or encode_path(self.name)
1.9 + ref = self.static()
1.10 + origin = ref and self.get_origin()
1.11 + static_name = origin and encode_path(origin)
1.12 + dynamic_name = name and encode_path(name) or encode_path(self.name)
1.13
1.14 # Assignments.
1.15
1.16 @@ -100,8 +102,13 @@
1.17
1.18 # Expressions.
1.19
1.20 + elif static_name:
1.21 + parent = ref.parent()
1.22 + context = ref.has_kind("<function>") and parent or None
1.23 + return "((__attr) {&%s, &%s})" % (context or "0", static_name)
1.24 +
1.25 else:
1.26 - return name
1.27 + return dynamic_name
1.28
1.29 class TrConstantValueRef(results.ConstantValueRef, TranslationResult):
1.30
1.31 @@ -1079,6 +1086,7 @@
1.32 #include "progconsts.h"
1.33 #include "progops.h"
1.34 #include "progtypes.h"
1.35 +#include "main.h"
1.36 """
1.37
1.38 def start_module(self):