changeset 48:3936d223989a

Introduce null_relocatable for any relocatable without real instance - Some dex type does not own a real instance, it actually a generator of child type. - null_relocatable is used to classify types without real instance.
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 20 Jun 2011 13:34:47 +0800
parents cd4e3584ed7f
children 38fdd422f611
files paraspace/dexfile.py
diffstat 1 files changed, 29 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/paraspace/dexfile.py	Mon Jun 20 13:32:15 2011 +0800
+++ b/paraspace/dexfile.py	Mon Jun 20 13:34:47 2011 +0800
@@ -393,11 +393,38 @@
     pass
 
 
+class relocatable(_dex_type):
+    data_size = None
+
+    @staticmethod
+    def parse(parent, data, off):
+        pass
+
+    @staticmethod
+    def sizeof(v):
+        return v.data_size
+
+    def to_str(self):
+        pass
+
+    def compute_size(self):
+        pass
+
+    def children(self):
+        raise NotImplementedError, \
+            '%s: does not implement children' % (self.__class__.__name__)
+    pass
+
+
+class null_relocatable(relocatable):
+    pass
+
+
 ## \brief Implicit reference to a target.
 #
 # It is a placeholder for storing relationship defined by an association.
 #
-class ref(_dex_type):
+class ref(null_relocatable):
     target_path = None
     target = None
 
@@ -453,29 +480,6 @@
     pass
 
 
-class relocatable(_dex_type):
-    data_size = None
-
-    @staticmethod
-    def parse(parent, data, off):
-        pass
-
-    @staticmethod
-    def sizeof(v):
-        return v.data_size
-
-    def to_str(self):
-        pass
-
-    def compute_size(self):
-        pass
-
-    def children(self):
-        raise NotImplementedError, \
-            '%s: does not implement children' % (self.__class__.__name__)
-    pass
-
-
 class array(relocatable):
     count_name = None
     child_type = None
@@ -716,7 +720,7 @@
     pass
 
 
-class depend(relocatable):
+class depend(null_relocatable):
     depend_on = None
     child_type = None