1.1 --- a/translator.py Mon Feb 27 00:55:52 2017 +0100
1.2 +++ b/translator.py Mon Feb 27 11:57:15 2017 +0100
1.3 @@ -23,10 +23,10 @@
1.4 first, get_builtin_class, init_item, is_newer, \
1.5 predefined_constants
1.6 from encoders import encode_access_instruction, encode_access_instruction_arg, \
1.7 - encode_function_pointer, encode_literal_constant, \
1.8 + encode_code, encode_function_pointer, encode_literal_constant, \
1.9 encode_literal_instantiator, encode_instantiator_pointer, \
1.10 - encode_instructions, \
1.11 - encode_path, encode_symbol, encode_type_attribute, \
1.12 + encode_instructions, encode_path, encode_pos, \
1.13 + encode_symbol, encode_type_attribute, \
1.14 is_type_attribute
1.15 from errors import InspectError, TranslateError
1.16 from os.path import exists, join
1.17 @@ -142,7 +142,7 @@
1.18
1.19 elif parent:
1.20 return "__store_via_object(&%s, %s, %s)" % (
1.21 - encode_path(parent), encode_symbol("pos", attrname), self.expr)
1.22 + encode_path(parent), encode_pos(attrname), self.expr)
1.23
1.24 # All other assignments involve the names as they were given.
1.25
1.26 @@ -160,7 +160,7 @@
1.27
1.28 elif parent:
1.29 return "__load_via_object(&%s, %s)" % (
1.30 - encode_path(parent), encode_symbol("pos", attrname))
1.31 + encode_path(parent), encode_pos(attrname))
1.32
1.33 # All other accesses involve the names as they were given.
1.34
1.35 @@ -979,8 +979,8 @@
1.36 parent, attrname = path.rsplit(".", 1)
1.37
1.38 self.writestmt("__store_via_object(&%s, %s, __load_via_object(&%s, %s));" % (
1.39 - encode_path(class_name), encode_symbol("pos", name),
1.40 - encode_path(parent), encode_symbol("pos", attrname)
1.41 + encode_path(class_name), encode_pos(name),
1.42 + encode_path(parent), encode_pos(attrname)
1.43 ))
1.44
1.45 def process_from_node(self, n):
1.46 @@ -1064,7 +1064,7 @@
1.47 elif guard == "common":
1.48 ref = first(self.deducer.accessor_all_general_types[location])
1.49 typeattr = encode_type_attribute(ref.get_origin())
1.50 - argstr = "%s, %s" % (encode_symbol("pos", typeattr), encode_symbol("code", typeattr))
1.51 + argstr = "%s, %s" % (encode_pos(typeattr), encode_code(typeattr))
1.52 else:
1.53 return
1.54
1.55 @@ -1369,8 +1369,7 @@
1.56 else:
1.57 kwargs.append(str(argexpr))
1.58 kwcodes.append("{%s, %s}" % (
1.59 - encode_symbol("ppos", arg.name),
1.60 - encode_symbol("pcode", arg.name)))
1.61 + encode_ppos(arg.name), encode_pcode(arg.name)))
1.62
1.63 # Store non-keyword arguments in the argument list, rejecting
1.64 # superfluous arguments.
1.65 @@ -1449,7 +1448,7 @@
1.66 target_var, target_var))
1.67 else:
1.68 stages.append("__load_via_object(%s.value, %s).fn" % (
1.69 - target_var, encode_symbol("pos", "__fn__")))
1.70 + target_var, encode_pos("__fn__")))
1.71
1.72 # With a known target, the function is obtained directly and called.
1.73 # By putting the invocation at the end of the final element in the