# HG changeset patch # User Paul Boddie # Date 1477432384 -7200 # Node ID 60b4859ab9d32d2d6c810943aa07ad6dcf5fb531 # Parent c88dbd0095198eefac5ce3c76b38dfdfdfd1ba6e Convert resolved names to attributes where static references are identified. Added missing inclusion of the program's own function declarations. diff -r c88dbd009519 -r 60b4859ab9d3 translator.py --- a/translator.py Tue Oct 25 23:10:29 2016 +0200 +++ b/translator.py Tue Oct 25 23:53:04 2016 +0200 @@ -84,8 +84,10 @@ # usable directly. For targets, no constant should be assigned and thus # the alias (or any plain name) will be used. - origin = self.static() and self.get_origin() - name = origin and encode_path(origin) or name and encode_path(name) or encode_path(self.name) + ref = self.static() + origin = ref and self.get_origin() + static_name = origin and encode_path(origin) + dynamic_name = name and encode_path(name) or encode_path(self.name) # Assignments. @@ -100,8 +102,13 @@ # Expressions. + elif static_name: + parent = ref.parent() + context = ref.has_kind("") and parent or None + return "((__attr) {&%s, &%s})" % (context or "0", static_name) + else: - return name + return dynamic_name class TrConstantValueRef(results.ConstantValueRef, TranslationResult): @@ -1079,6 +1086,7 @@ #include "progconsts.h" #include "progops.h" #include "progtypes.h" +#include "main.h" """ def start_module(self):