changeset 65:ce1d5a058d5a

Fix argument issue of to_str() of dex types
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 28 Jun 2011 14:23:08 +0800
parents d644c13b8cb2
children fa44a8acba6a
files paraspace/dexfile.py
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/paraspace/dexfile.py	Tue Jun 28 13:36:39 2011 +0800
+++ b/paraspace/dexfile.py	Tue Jun 28 14:23:08 2011 +0800
@@ -540,6 +540,7 @@
         self.data_size = size
         pass
 
+    @staticmethod
     def to_str(self):
         to_str = self.child_type.to_str
         strs = [to_str(item) for item in self.items]
@@ -593,7 +594,7 @@
         child_clazzs = [getattr(self.__class__, child_name)
                         for child_name in self.children()]
         children = [getattr(self, child_name)
-                    for child_name in self.child_names]
+                    for child_name in self.children()]
         child_strs = map(lambda child_clazz, child: \
                              child_clazz.to_str(child),
                          child_clazzs, children)
@@ -644,6 +645,7 @@
         self.data_size = self.sizeof(self.value)
         pass
 
+    @staticmethod
     def to_str(self):
         if self.value is None:
             return ''
@@ -708,6 +710,7 @@
         self.data_size = self.sizeof(self.value)
         pass
 
+    @staticmethod
     def to_str(self):
         data = self.child_type.to_str(self.value)
         return data
@@ -731,6 +734,7 @@
     def sizeof(self, v):
         return 0
 
+    @staticmethod
     def to_str(self):
         return ''
 
@@ -1420,6 +1424,7 @@
         self.data_size = opcodes_size
         pass
     
+    @staticmethod
     def to_str(self):
         #
         # Parse debug opcodes
@@ -1443,21 +1448,21 @@
             elif opcode == self.DBG_START_LOCAL:
                 codebin = chr(opcode) + _to_uleb128(code[1]) + \
                     _to_uleb128(code[2]) + _to_uleb128(code[3])
-                codebins.append(codebin)
+                opcodebins.append(codebin)
                 pass
             elif opcode == self.DBG_START_LOCAL_EXTENDED:
                 codebin = chr(opcode) + _to_uleb128(code[1]) + \
                     _to_uleb128(code[2]) + _to_uleb128(code[3]) + \
                     _to_uleb128(code[4])
-                codebins.append(codebin)
+                opcodebins.append(codebin)
                 pass
             elif opcode == self.DBG_END_LOCAL:
                 codebin = chr(opcode) + _to_uleb128(code[1])
-                codebins.append(codebin)
+                opcodebins.append(codebin)
                 pass
             elif opcode == self.DBG_RESTART_LOCAL:
                 codebin = chr(opcode) + _to_uleb128(code[1])
-                codebins.append(codebin)
+                opcodebins.append(codebin)
                 pass
             elif opcode in (self.DBG_SET_PROLOGUE_END,
                             self.DBG_SET_EPILOGUE_BEGIN,
@@ -1517,6 +1522,7 @@
         self.data_size = size_sz + size + 1
         pass
 
+    @staticmethod
     def to_str(self):
         size = len(self.data)
         self.size = size