1.1 --- a/micropython/rsvp.py Mon Apr 19 01:30:02 2010 +0200
1.2 +++ b/micropython/rsvp.py Tue Apr 20 01:11:41 2010 +0200
1.3 @@ -21,6 +21,7 @@
1.4
1.5 from micropython.data import Attr, Const, Class, Function, Module
1.6 from micropython.program import Block, DataObject, DataValue
1.7 +from micropython.raw import RawObject
1.8
1.9 def name(attr):
1.10 if isinstance(attr, Attr):
1.11 @@ -32,20 +33,10 @@
1.12
1.13 # Serialisation-related classes.
1.14
1.15 -class RSVPObject:
1.16 +class RSVPObject(RawObject):
1.17
1.18 "A generic data object wrapper."
1.19
1.20 - def __init__(self, item):
1.21 - self.item = item
1.22 -
1.23 - def set_location(self, location, with_builtins):
1.24 - self.item.location = location
1.25 - return location + 1
1.26 -
1.27 - def finalise_location(self, with_builtins):
1.28 - pass
1.29 -
1.30 def _finalise_location(self, with_builtins):
1.31
1.32 """
1.33 @@ -55,7 +46,7 @@
1.34
1.35 item = self.item
1.36
1.37 - if not with_builtins and item.module.name == "__builtins__" and item.astnode.doc is None:
1.38 + if not self.is_generated(with_builtins):
1.39 item.code_body_location = item.full_name()
1.40 else:
1.41 item.code_body_location = item.get_body_block().location
1.42 @@ -112,9 +103,7 @@
1.43
1.44 # NOTE: The instantiator code is the first block of the class.
1.45
1.46 - with_instantiator = with_builtins or item.module.name != "__builtins__" or item.astnode.doc is not None
1.47 -
1.48 - if not with_instantiator:
1.49 + if not self.is_generated(with_builtins):
1.50 instantiator_code_location = item.full_name()
1.51 else:
1.52 instantiator_code_location = item.get_instantiator().blocks[0].location
1.53 @@ -185,7 +174,7 @@
1.54 # Set the code location only where the code has been
1.55 # generated.
1.56
1.57 - if not with_builtins and item.module.name == "__builtins__" and item.astnode.doc is None:
1.58 + if not self.is_generated(with_builtins):
1.59 item.code_location = item.full_name()
1.60
1.61 # Skip any defaults for named functions.