1.1 --- a/micropython/rsvp.py Sat Jan 29 21:07:27 2011 +0100
1.2 +++ b/micropython/rsvp.py Sat Feb 19 23:29:55 2011 +0100
1.3 @@ -149,19 +149,34 @@
1.4
1.5 def set_location(self, location, with_builtins):
1.6 location = RSVPObject.set_location(self, location, with_builtins)
1.7 - return location + len(self.raw_data())
1.8 +
1.9 + # Include the __class__ attribute in the size.
1.10 +
1.11 + return location + 1 + len(self.raw_data())
1.12
1.13 def as_raw(self, objtable, paramtable, with_builtins):
1.14 item = self.item
1.15 - # NOTE: Need class details!
1.16 + classcode = objtable.as_list().get_code(item.value_type_name())
1.17 + attrcode = objtable.get_index(item.value_type_name())
1.18 return [
1.19 DataObject(
1.20 - objtable.as_list().get_code(item.value_type_name()),
1.21 - objtable.get_index(item.value_type_name()), # is instance
1.22 + classcode,
1.23 + attrcode, # is instance
1.24 None,
1.25 item.value_type_name(),
1.26 - 1 # size
1.27 + 3 # size (header plus __class__ plus data)
1.28 + ),
1.29 +
1.30 + # The __class__ attribute for instances.
1.31 +
1.32 + DataValue(
1.33 + PlaceholderContext,
1.34 + item.location
1.35 )
1.36 +
1.37 + # NOTE: The RSVP library needs changing if more attributes are added
1.38 + # NOTE: here.
1.39 +
1.40 ] + self.raw_data()
1.41
1.42 def raw_data(self):