Mercurial > paraspace
view paraspace/injection.py @ 87:cd1ee85853f4
Add injection.py
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sat, 23 Jul 2011 23:02:39 +0800 |
parents | |
children | bbe8d5cbe368 |
line wrap: on
line source
def _deep_travel(obj, cloner, adjuster, visit_log=None): from paraspace.dexfile import _dex_type if not visit_log: visit_log = {} pass if id(obj) in visit_log: return visit_log[id(obj)] attrs = [attr for attr in dir(obj) if not attr.startswith('_') and \ isinstance(getattr(obj, attr), _dex_type)] pass def dexfile_insert_class(dex, class_def): classId_orig = class_def.classIdx if dex_find_type(dex, class_orig): raise RuntimeError, 'duplicated type' classId = dex_dup_insert_type(dex, classId_orig) superclassId_orig = class_def.superclassId superclassId = dex_find_type(dex, superclassId_orig) or \ dex_dup_insert_type(dex, superclassId_orig) if dex.interfacesOffRef.is_true: interfaces_orig = dex.interfacesOffRef.value interfaces = dex_dup_insert_typelist(dex, interfaces_org) pass sourceFileIdx_orig = dex.sourceFileIdx sourceFileIdx = dex_find_type(dex, sourceFileIdx_orig) or \ dex_dup_insert_type(dex, sourceFileIdx_orig) if dex.annotationsOffRef.is_true: annotations_orig = dex.annotationsOffRef.value annotations = dex_dup_insert(dex, annotations_orig) pass if dex.classDataOffRef.is_true: class_data_orig = dex.classDataOffRef.value class_data = dex_dup_insert(dex, class_data_orig) pass pass