1.1 --- a/micropython/__init__.py Thu Sep 04 19:44:39 2008 +0200
1.2 +++ b/micropython/__init__.py Fri Sep 05 00:04:20 2008 +0200
1.3 @@ -142,6 +142,8 @@
1.4 const.location = pos
1.5 image.append(const)
1.6
1.7 + last_module = self.modules_ordered[-1]
1.8 +
1.9 for module in self.modules_ordered:
1.10
1.11 if not with_builtins and module.name == "__builtins__":
1.12 @@ -229,10 +231,12 @@
1.13
1.14 # Append the module top-level code to the image.
1.15
1.16 - code = trans.get_module_code()
1.17 + code = trans.get_module_code(final=(module is last_module))
1.18 image += code
1.19 pos += len(code)
1.20
1.21 + # Remember the generated code and the location of the first instruction.
1.22 +
1.23 self.code = image
1.24 self.code_location = self.modules["__main__"].code_location
1.25 return image