1.1 --- a/micropython/rsvp.py Sat Feb 26 01:12:25 2011 +0100
1.2 +++ b/micropython/rsvp.py Sun Feb 27 02:45:38 2011 +0100
1.3 @@ -85,7 +85,7 @@
1.4
1.5 # Include the instance template and __class__ attribute in the size.
1.6
1.7 - return RSVPObject.set_location(self, location + 2, with_builtins)
1.8 + return RSVPObject.set_location(self, location + 1, with_builtins)
1.9
1.10 def finalise_location(self, with_builtins):
1.11 self._finalise_location(with_builtins)
1.12 @@ -120,17 +120,10 @@
1.13 attrcode, # is instance
1.14 call_method_code_location,
1.15 item.full_name(),
1.16 - len(item.instance_attributes()) + 1, # size
1.17 + len(item.instance_attributes()), # size (excluding __class__)
1.18 call_method_funccode # funccode
1.19 ),
1.20
1.21 - # The __class__ attribute for instances.
1.22 -
1.23 - DataValue(
1.24 - PlaceholderContext,
1.25 - item.location
1.26 - ),
1.27 -
1.28 # Class...
1.29
1.30 DataObject(
1.31 @@ -149,33 +142,19 @@
1.32
1.33 def set_location(self, location, with_builtins):
1.34 location = RSVPObject.set_location(self, location, with_builtins)
1.35 -
1.36 - # Include the __class__ attribute in the size.
1.37 -
1.38 - return location + 1 + len(self.raw_data())
1.39 + return location + len(self.raw_data())
1.40
1.41 def as_raw(self, objtable, paramtable, with_builtins):
1.42 item = self.item
1.43 classcode = objtable.as_list().get_code(item.value_type_name())
1.44 attrcode = objtable.get_index(item.value_type_name())
1.45 - name_parts = item.value_type_name_parts()
1.46 - attr = objtable.access(*name_parts)
1.47 - cls = attr.get_value()
1.48 -
1.49 return [
1.50 DataObject(
1.51 classcode,
1.52 attrcode, # is instance
1.53 None,
1.54 item.value_type_name(),
1.55 - 3 # size (header plus __class__ plus data)
1.56 - ),
1.57 -
1.58 - # The __class__ attribute for instances.
1.59 -
1.60 - DataValue(
1.61 - PlaceholderContext,
1.62 - cls.location
1.63 + 2 # size (header plus data)
1.64 )
1.65
1.66 # NOTE: The RSVP library needs changing if more attributes are added
1.67 @@ -206,27 +185,23 @@
1.68 if not self.is_generated(with_builtins):
1.69 item.code_location = item.full_name()
1.70
1.71 - # Skip __class__ plus any defaults for static functions.
1.72 + # Skip any defaults for static functions.
1.73
1.74 elif not item.is_dynamic():
1.75 - item.code_location = location + 1 + len(item.defaults)
1.76 + item.code_location = location + len(item.defaults)
1.77
1.78 - # Skip __class__ plus any defaults for dynamic functions.
1.79 + # Skip any defaults for dynamic functions.
1.80
1.81 else:
1.82 - item.code_location = location + 1
1.83 + item.code_location = location
1.84
1.85 - # Include the __class__ attribute.
1.86 -
1.87 - return location + 1
1.88 + return location
1.89
1.90 def finalise_location(self, with_builtins):
1.91 self._finalise_location(with_builtins)
1.92
1.93 def as_raw(self, objtable, paramtable, with_builtins):
1.94 item = self.item
1.95 - attr = objtable.access("__builtins__", "function")
1.96 - cls = attr.get_value()
1.97 # NOTE: Need class and parameter details! Should arguably be an instance of types.FunctionType.
1.98 return [
1.99 DataObject(
1.100 @@ -236,13 +211,6 @@
1.101 "__builtins__.function",
1.102 len(item.defaults) + 1, # size (not accurate for lambda functions before instantiation)
1.103 paramtable.as_list().get_code(item.full_name()) # funccode
1.104 - ),
1.105 -
1.106 - # The __class__ attribute for functions.
1.107 -
1.108 - DataValue(
1.109 - PlaceholderContext,
1.110 - cls.location
1.111 )
1.112 ]
1.113