1.1 --- a/micropython/__init__.py Fri Nov 09 00:19:03 2007 +0100
1.2 +++ b/micropython/__init__.py Tue Nov 20 00:36:00 2007 +0100
1.3 @@ -78,7 +78,9 @@
1.4 "Return a dictionary mapping modules to structures."
1.5
1.6 image = []
1.7 - for module in self.get_modules():
1.8 + module_main = {}
1.9 +
1.10 + for module_name, module in self.modules.items():
1.11 pos = len(image)
1.12
1.13 # Position the module in the image and make a translation.
1.14 @@ -138,13 +140,17 @@
1.15 image += code
1.16 pos += len(code)
1.17
1.18 + # Remember the position of the module code.
1.19 +
1.20 + module_main[module_name] = pos
1.21 +
1.22 # Append the module top-level code to the image.
1.23
1.24 code = trans.get_module_code()
1.25 image += code
1.26 pos += len(code)
1.27
1.28 - return image
1.29 + return image, module_main
1.30
1.31 def get_object_table(self):
1.32
2.1 --- a/micropython/ast.py Fri Nov 09 00:19:03 2007 +0100
2.2 +++ b/micropython/ast.py Tue Nov 20 00:36:00 2007 +0100
2.3 @@ -41,6 +41,9 @@
2.4 "A translated module."
2.5
2.6 def __init__(self, module):
2.7 +
2.8 + "Initialise the translation with an inspected 'module'."
2.9 +
2.10 ASTVisitor.__init__(self)
2.11 self.visitor = self
2.12 self.module = module
2.13 @@ -163,7 +166,8 @@
2.14
2.15 def visitDict(self, node): return []
2.16
2.17 - def visitDiscard(self, node): return []
2.18 + def visitDiscard(self, node):
2.19 + return self.dispatch(node.expr)
2.20
2.21 def visitDiv(self, node): return []
2.22