Mercurial > paraspace
changeset 56:7f23def22a95
Resolve problem of false of cond objects when build associations
When a cond object is false, it should return an empty set for
association. But, it was an error. It is fixed by checking status of
cond objects.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 24 Jun 2011 10:56:33 +0800 |
parents | 6e4cf6905729 |
children | fa8fe7d714b9 |
files | paraspace/dex_deptracker.py |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/paraspace/dex_deptracker.py Fri Jun 24 00:33:08 2011 +0800 +++ b/paraspace/dex_deptracker.py Fri Jun 24 10:56:33 2011 +0800 @@ -591,6 +591,16 @@ def _build_associations(root_obj): + def get_elts(parent, path): + parts = path.split('.') + obj = parent + for part in parts: + obj = _dex_tree_get_child(obj, part) + if isinstance(obj, dexfile.cond) and not obj.is_true: + return () + pass + return obj + for obj, parents, name_path in \ _travel_dex_relocatable(root_obj): if isinstance(obj, dexfile._objs_asso): @@ -601,9 +611,8 @@ break pass - print parent, obj.left - left_elts = _dex_tree_get_child(parent, obj.left) - right_elts = _dex_tree_get_child(parent, obj.right) + left_elts = get_elts(parent, obj.left) + right_elts = get_elts(parent, obj.right) obj.build_associations(left_elts, right_elts) pass pass