1.1 --- a/translator.py Tue Mar 07 17:32:14 2017 +0100
1.2 +++ b/translator.py Tue Mar 07 18:10:00 2017 +0100
1.3 @@ -811,7 +811,12 @@
1.4
1.5 # Produce the body and any additional return statement.
1.6
1.7 - expr = self.process_structure_node(n.code) or PredefinedConstantRef("None")
1.8 + expr = self.process_structure_node(n.code) or \
1.9 + self.in_method() and \
1.10 + function_name.rsplit(".", 1)[-1] == "__init__" and \
1.11 + TrResolvedNameRef("self", self.importer.function_locals[function_name]["self"]) or \
1.12 + PredefinedConstantRef("None")
1.13 +
1.14 if not isinstance(expr, ReturnRef):
1.15 self.writestmt("return %s;" % expr)
1.16
1.17 @@ -847,7 +852,6 @@
1.18
1.19 # Produce an appropriate access to an attribute's value.
1.20
1.21 - parameters = self.importer.function_parameters.get(self.get_namespace_path())
1.22 name_to_value = "%s.value" % name
1.23
1.24 # Write a test that raises a TypeError upon failure.
1.25 @@ -1184,18 +1188,17 @@
1.26
1.27 # Encode the arguments.
1.28
1.29 - argstr = ", ".join(args)
1.30 + # Where literal instantiation is occurring, add an argument indicating
1.31 + # the number of values. The context is excluded.
1.32 +
1.33 + if literal_instantiation:
1.34 + argstr = "__ARGS(%s), %d" % (", ".join(args[1:]), len(args) - 1)
1.35 + else:
1.36 + argstr = ", ".join(args)
1.37 +
1.38 kwargstr = kwargs and ("__ARGS(%s)" % ", ".join(kwargs)) or "0"
1.39 kwcodestr = kwcodes and ("__KWARGS(%s)" % ", ".join(kwcodes)) or "0"
1.40
1.41 - # Where literal instantiation is occurring, add an argument indicating
1.42 - # the number of values.
1.43 -
1.44 - if literal_instantiation:
1.45 - argstr = "__ARGS(%s), %d" % (argstr, len(args) - 1)
1.46 - elif instantiation:
1.47 - argstr = "__ARGS(%s)" % argstr
1.48 -
1.49 # First, the invocation expression is presented.
1.50
1.51 stages = []