1.1 --- a/micropython/__init__.py Sun Mar 11 01:49:53 2012 +0100
1.2 +++ b/micropython/__init__.py Mon Mar 26 23:24:38 2012 +0200
1.3 @@ -5,7 +5,7 @@
1.4 from the simplify package but has had various details related to that package
1.5 removed.
1.6
1.7 -Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -44,6 +44,7 @@
1.13 import micropython.opt
1.14 import micropython.inspect
1.15 import micropython.table
1.16 +import bisect
1.17 import os
1.18
1.19 try:
1.20 @@ -316,7 +317,7 @@
1.21
1.22 for name, descendant in obj.all_descendants().items():
1.23 if descendant in all_objects:
1.24 - attributes[name] = descendant
1.25 + attributes["#" + name] = descendant
1.26
1.27 t.add(full_name, attributes)
1.28
1.29 @@ -362,6 +363,16 @@
1.30
1.31 return self.paramtable
1.32
1.33 + def object_at(self, pos):
1.34 +
1.35 + "Return the object whose code can be found at 'pos'."
1.36 +
1.37 + i = bisect.bisect_left(self.code, Location(pos))
1.38 + if i > 0:
1.39 + return self.code[i-1]
1.40 + else:
1.41 + return None
1.42 +
1.43 class Importer:
1.44
1.45 "An import machine, searching for and loading modules."