1.1 --- a/micropython/data.py Thu Apr 23 00:52:33 2009 +0200
1.2 +++ b/micropython/data.py Sun Apr 26 03:24:12 2009 +0200
1.3 @@ -462,8 +462,9 @@
1.4 objtable.get_index(self.value_type_name()),
1.5 None,
1.6 None,
1.7 - 1,
1.8 - self.value_type_name()
1.9 + 1, # instance
1.10 + self.value_type_name(),
1.11 + 1 # size
1.12 )
1.13 ] + self.raw_data()
1.14
1.15 @@ -550,7 +551,7 @@
1.16 def __shortrepr__(self):
1.17 return "Class(%r, %s)" % (self.name, shortrepr(self.parent))
1.18
1.19 - def as_raw(self, objtable, paramtable):
1.20 + def as_raw(self, objtable, paramtable, with_instantiator=1):
1.21 classcode = objtable.as_list().get_code(self.full_name())
1.22 attrcode = objtable.get_index(self.full_name())
1.23
1.24 @@ -562,7 +563,10 @@
1.25
1.26 # NOTE: The instantiator code is the first block of the class.
1.27
1.28 - instantiator_code_location = self.get_instantiator().blocks[0].location
1.29 + if not with_instantiator:
1.30 + instantiator_code_location = self.full_name()
1.31 + else:
1.32 + instantiator_code_location = self.get_instantiator().blocks[0].location
1.33
1.34 return [
1.35
1.36 @@ -574,8 +578,9 @@
1.37 call_method_value and len(call_method_value.positional_names),
1.38 call_method_value and len(call_method_value.defaults)
1.39 ),
1.40 - 1,
1.41 - self.full_name()
1.42 + 1, # instance
1.43 + self.full_name(),
1.44 + len(self.instance_attributes()) + 1 # size
1.45 ),
1.46
1.47 # Class...
1.48 @@ -586,8 +591,9 @@
1.49 len(self.get_instantiator().positional_names),
1.50 len(self.get_instantiator().defaults)
1.51 ),
1.52 - 0,
1.53 - self.full_name()
1.54 + 0, # not instance
1.55 + self.full_name(),
1.56 + len(self.class_attributes()) + 1 # size
1.57 )
1.58 ]
1.59
1.60 @@ -958,7 +964,7 @@
1.61 )
1.62
1.63 def as_raw(self, objtable, paramtable):
1.64 - # NOTE: Need class and parameter details! Should arguably be types.FunctionType.
1.65 + # NOTE: Need class and parameter details! Should arguably be an instance of types.FunctionType.
1.66 return [
1.67 DataObject(
1.68 objtable.as_list().get_code("__builtins__.function"),
1.69 @@ -968,8 +974,9 @@
1.70 len(self.positional_names),
1.71 len(self.defaults)
1.72 ),
1.73 - 0,
1.74 + 1, # instance
1.75 "__builtins__.function",
1.76 + len(self.defaults) + 1, # size
1.77 paramtable.as_list().get_code(self.full_name())
1.78 )
1.79 ]
1.80 @@ -1072,7 +1079,7 @@
1.81
1.82 "Make a function from a method."
1.83
1.84 - function = Function(self.name, self.parent, self.argnames[1:], self.defaults,
1.85 + function = Function(self.name + " (function)", self.parent, self.argnames[1:], self.defaults,
1.86 self.has_star, self.has_dstar, self.module, self.astnode)
1.87 function.default_attrs = self.default_attrs
1.88 return function
1.89 @@ -1169,8 +1176,9 @@
1.90 None, # module name not used as an attribute
1.91 None,
1.92 None,
1.93 - 0,
1.94 - self.full_name()
1.95 + 1, # instance
1.96 + self.full_name(),
1.97 + len(self.module_attributes()) + 1 # size
1.98 )
1.99 ]
1.100