Mercurial > paraspace
diff paraspace/injection.py @ 96:1769e52bdd9d
Make dexfile_insert_class() pass the testcase
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 25 Jul 2011 16:49:28 +0800 |
parents | 88645ab29aeb |
children | c0c127c7b37e |
line wrap: on
line diff
--- a/paraspace/injection.py Mon Jul 25 15:22:03 2011 +0800 +++ b/paraspace/injection.py Mon Jul 25 16:49:28 2011 +0800 @@ -23,7 +23,7 @@ rel_children = _relocatable_children(obj) for attr, value in rel_children: - _travel_conn_objs(value, worker, visit_log) + _travel_desc_relocatable(value, worker, visit_log) pass pass @@ -67,8 +67,10 @@ array.items.append(obj) count_name = array.count_name - count = _dex_tree_get_child(dex, count_name) - _dex_tree_set_child(dex, count_name, count + 1) + if count_name: + count = _dex_tree_get_child(dex, count_name) + _dex_tree_set_child(dex, count_name, count + 1) + pass pass @@ -154,9 +156,9 @@ def has_classdef(clazz): class_typeIds = set([classdef.classIdx for classdef in dex.classDefs.items]) - return dex.classIdx in class_typeIds + return clazz.classIdx in class_typeIds - _travel_desc_relocatable(obj, cloner, visit_log) + _travel_desc_relocatable(clazz, cloner, visit_log) merge_unique_strdata() merge_unique_strid() @@ -171,12 +173,12 @@ dex_append_obj_list(dex, obj) pass - if has_classef(clazz): + if has_classdef(clazz): raise RuntimeError, \ 'clone a class \'%s\'that is already in the DEXFile' % \ classdef_name(clazz) - clone = visit_log[id(obj)] + clone = visit_log[id(clazz)] return clone