1.1 --- a/micropython/__init__.py Sun Aug 17 20:46:49 2008 +0200
1.2 +++ b/micropython/__init__.py Mon Aug 18 01:40:18 2008 +0200
1.3 @@ -71,6 +71,7 @@
1.4
1.5 self.objtable = None
1.6 self.paramtable = None
1.7 + self.clstable = None
1.8
1.9 # Constant records.
1.10
1.11 @@ -113,6 +114,7 @@
1.12
1.13 objtable = self.get_object_table()
1.14 paramtable = self.get_parameter_table()
1.15 + clstable = self.get_class_table()
1.16
1.17 image = []
1.18
1.19 @@ -235,6 +237,21 @@
1.20
1.21 return self.objtable
1.22
1.23 + def get_class_table(self):
1.24 +
1.25 + "Return a table with details of class compatibility."
1.26 +
1.27 + if self.clstable is None:
1.28 + t = self.clstable = micropython.table.Table()
1.29 + for module in self.get_modules():
1.30 + for obj in module.all_objects:
1.31 + if isinstance(obj, micropython.inspect.Class):
1.32 + compatible = [obj] + obj.descendants
1.33 + compatible_dict = dict([(cls.full_name(), cls) for cls in compatible])
1.34 + t.add(obj.full_name(), compatible_dict)
1.35 +
1.36 + return self.clstable
1.37 +
1.38 def get_parameter_table(self):
1.39
1.40 "Return a table with details of parameters for functions and methods."