1.1 --- a/micropython/common.py Mon Jun 04 01:38:25 2012 +0200
1.2 +++ b/micropython/common.py Mon Jun 04 01:50:55 2012 +0200
1.3 @@ -370,6 +370,21 @@
1.4
1.5 return all_objtypes
1.6
1.7 +def filter_using_self(objtypes, cls):
1.8 +
1.9 + """
1.10 + Filter the given 'objtypes' (a collection of object names and static
1.11 + indicators) for the given 'cls', returning only the (name, static) elements
1.12 + compatible with 'cls' and its descendants.
1.13 + """
1.14 +
1.15 + descendants = cls.all_descendants()
1.16 + filtered = []
1.17 + for objname, is_static in objtypes:
1.18 + if objname == cls.full_name() or objname in descendants:
1.19 + filtered.append((objname, is_static))
1.20 + return filtered
1.21 +
1.22 # Errors.
1.23
1.24 class ProcessingError(Exception):