Mercurial > paraspace
comparison paraspace/dex_deptracker.py @ 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 |
comparison
equal
deleted
inserted
replaced
55:6e4cf6905729 | 56:7f23def22a95 |
---|---|
589 pass | 589 pass |
590 pass | 590 pass |
591 | 591 |
592 | 592 |
593 def _build_associations(root_obj): | 593 def _build_associations(root_obj): |
594 def get_elts(parent, path): | |
595 parts = path.split('.') | |
596 obj = parent | |
597 for part in parts: | |
598 obj = _dex_tree_get_child(obj, part) | |
599 if isinstance(obj, dexfile.cond) and not obj.is_true: | |
600 return () | |
601 pass | |
602 return obj | |
603 | |
594 for obj, parents, name_path in \ | 604 for obj, parents, name_path in \ |
595 _travel_dex_relocatable(root_obj): | 605 _travel_dex_relocatable(root_obj): |
596 if isinstance(obj, dexfile._objs_asso): | 606 if isinstance(obj, dexfile._objs_asso): |
597 rev_parents = list(parents) | 607 rev_parents = list(parents) |
598 rev_parents.reverse() | 608 rev_parents.reverse() |
599 for parent in rev_parents: | 609 for parent in rev_parents: |
600 if isinstance(parent, dexfile.composite): | 610 if isinstance(parent, dexfile.composite): |
601 break | 611 break |
602 pass | 612 pass |
603 | 613 |
604 print parent, obj.left | 614 left_elts = get_elts(parent, obj.left) |
605 left_elts = _dex_tree_get_child(parent, obj.left) | 615 right_elts = get_elts(parent, obj.right) |
606 right_elts = _dex_tree_get_child(parent, obj.right) | |
607 obj.build_associations(left_elts, right_elts) | 616 obj.build_associations(left_elts, right_elts) |
608 pass | 617 pass |
609 pass | 618 pass |
610 pass | 619 pass |
611 | 620 |