Mercurial > paraspace
diff paraspace/dex_deptracker.py @ 55:6e4cf6905729
Seeking parents in reversed order for _build_associations()
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 24 Jun 2011 00:33:08 +0800 |
parents | 870312703ba1 |
children | 7f23def22a95 |
line wrap: on
line diff
--- a/paraspace/dex_deptracker.py Thu Jun 23 09:32:51 2011 +0800 +++ b/paraspace/dex_deptracker.py Fri Jun 24 00:33:08 2011 +0800 @@ -166,7 +166,14 @@ def _dex_tree_get_child(obj, child_name): child_parts = child_name.split('.') + last_child_part = '' for child_part in child_parts: + if isinstance(obj, dexfile.cond) and not obj.is_true: + raise AttributeError, \ + 'dexfile.cond is not true for %s of %s' % \ + (last_child_part, child_name) + last_child_part = child_part + if isinstance(obj, list): idx = int(child_part) obj = obj[idx] @@ -587,14 +594,17 @@ for obj, parents, name_path in \ _travel_dex_relocatable(root_obj): if isinstance(obj, dexfile._objs_asso): - for parent in parents: + rev_parents = list(parents) + rev_parents.reverse() + for parent in rev_parents: if isinstance(parent, dexfile.composite): break pass + print parent, obj.left left_elts = _dex_tree_get_child(parent, obj.left) right_elts = _dex_tree_get_child(parent, obj.right) - obj.build_associations() + obj.build_associations(left_elts, right_elts) pass pass pass