diff paraspace/dexfile.py @ 53:705356005362

Fix bug of install marker through ref
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 22 Jun 2011 20:22:03 +0800
parents 00d106f6c427
children 870312703ba1
line wrap: on
line diff
--- a/paraspace/dexfile.py	Tue Jun 21 18:36:45 2011 +0800
+++ b/paraspace/dexfile.py	Wed Jun 22 20:22:03 2011 +0800
@@ -427,7 +427,6 @@
 #
 class ref(_dex_type):
     target_path = None
-    target = None
 
     def __init__(self, target_path=None):
         self.target_path = target_path
@@ -638,7 +637,9 @@
         return data
 
     def children(self):
-        return ('value',)
+        if self.is_true:
+            return ('value',)
+        return ()
     pass
 
 
@@ -702,7 +703,7 @@
     pass
 
 
-class abs_value(relocatable):
+class abs_value(_dex_type):
     value = None
     
     def __init__(self, value):
@@ -710,9 +711,8 @@
         pass
 
     def parse(self, parse, data, off):
-        obj = abs_value(self.value)
-        return obj
-
+        return self.value
+    
     def sizeof(self, v):
         return 0
 
@@ -720,7 +720,7 @@
         return ''
 
     def children(self):
-        return ('value',)
+        return ()
     pass
 
 
@@ -992,10 +992,10 @@
     startAddr = uint32
     insnCount = uint16
     handlerOff = depend_off_rel('_DEX_Code.handlers_size',
-                                '_DEX_Try.catch_ref.target')(uint16)
+                                '_DEX_Try.catch_ref')(uint16)
     catch_ref = ref('_DEX_Catch')
 
-    child_names = 'startAddr insnCount handlerOff'.split()
+    child_names = 'startAddr insnCount handlerOff catch_ref'.split()
     pass
 
 
@@ -1021,7 +1021,7 @@
                            _DEX_CatchAllHandler)
     try_ref = ref('_DEX_Try')
 
-    child_names = 'size handlers catchAllHandler'.split()
+    child_names = 'size handlers catchAllHandler try_ref'.split()
 
     @property
     def catchesAll(self):
@@ -1431,7 +1431,7 @@
         return ''.join(opcodebins)
 
     def children(self):
-        return ('opcodes',)
+        return ()
     pass
 
 
@@ -1587,7 +1587,6 @@
         map_items = [self.block_defs[map_item.type]
                      for map_item in self.maps.items.items]
         children = map_items + ['maps']
-        print children
         return children
     pass