1.1 --- a/micropython/syspython.py Mon Jul 01 00:47:43 2013 +0200
1.2 +++ b/micropython/syspython.py Mon Jul 01 02:10:23 2013 +0200
1.3 @@ -299,7 +299,7 @@
1.4 compiler.ast.Assign(
1.5 [special_name(alias or name)],
1.6 compiler.ast.CallFunc(
1.7 - special_name("__loadattribute__"),
1.8 + special_name("__loadattr__"),
1.9 [special_name(node.modname), special_name(name)]
1.10 )
1.11 )
1.12 @@ -314,10 +314,19 @@
1.13 self.units.append(node.unit)
1.14
1.15 try:
1.16 - # Ignore functions when generating the main function.
1.17 + if self.in_main:
1.18 +
1.19 + # Generate rebindings of functions.
1.20
1.21 - if self.in_main:
1.22 - return compiler.ast.Stmt([])
1.23 + fn = node.unit
1.24 + if fn.name == fn.original_name:
1.25 + return compiler.ast.Stmt([])
1.26 + else:
1.27 + return compiler.ast.CallFunc(
1.28 + special_name("__storeattr__"),
1.29 + [quoted_ref(fn.parent), special_name(fn.original_name),
1.30 + quoted_ref(fn)]
1.31 + )
1.32 else:
1.33 return self._visitFunctionDefinition(node)
1.34 finally: