Mercurial > paraspace
changeset 28:5ce7ca1187b3
Pass throught markers for dex types
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 07 Jun 2011 22:57:28 +0800 |
parents | 15cb829ac442 |
children | b0cc5da28141 |
files | paraspace/dex_deptracker.py paraspace/tests/dexfile_test.py |
diffstat | 2 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/paraspace/dex_deptracker.py Tue Jun 07 22:30:29 2011 +0800 +++ b/paraspace/dex_deptracker.py Tue Jun 07 22:57:28 2011 +0800 @@ -45,26 +45,27 @@ return False return True + # + # pass throught markers + # + while isinstance(clazz, _marker): + clazz = clazz.back_type + pass + travel_queue = [(getattr(clazz, attr_name), name_path + '.' + attr_name) for attr_name in dir(clazz) if travelable(getattr(clazz, attr_name), attr_name)] - print travel_queue while travel_queue: attr, name_path = travel_queue.pop(0) if isinstance(attr, _marker): - child = attr.back_type - travel_queue.append((child, name_path)) - continue - - yield attr, name_path - - if isinstance(attr, _marker): # # transparent. Enqueue back_type with the same name again. # child = attr.back_type travel_queue.append((child, name_path)) continue + + yield attr, name_path if isinstance(attr, _nest_types): if isinstance(attr, dexfile.array):
--- a/paraspace/tests/dexfile_test.py Tue Jun 07 22:30:29 2011 +0800 +++ b/paraspace/tests/dexfile_test.py Tue Jun 07 22:57:28 2011 +0800 @@ -127,6 +127,7 @@ pass dex_deptracker.dexfile = new_dexfile dexfile = new_dexfile + dex_deptracker._nest_types = (dexfile.array, dexfile.cond, dexfile.switch) pass @@ -144,7 +145,6 @@ ] attr_names = set([attr_info[1] for attr_info in attr_infos]) - print attr_names assert '_DEX_AnnotationsDirectoryItem.classAnnotationsOff' in attr_names assert '_DEX_AnnotationsDirectoryItem.fieldsSize' in attr_names assert '_DEX_AnnotationsDirectoryItem.methodsSize' in attr_names