1.1 --- a/micropython/rsvp.py Sun May 11 21:50:30 2008 +0200
1.2 +++ b/micropython/rsvp.py Mon May 12 23:54:16 2008 +0200
1.3 @@ -27,8 +27,12 @@
1.4
1.5 stack_usage = 0
1.6
1.7 - def __init__(self, attr=None):
1.8 + def __init__(self, attr=None, context=None):
1.9 self.attr = attr
1.10 + if self.attr is not None and isinstance(self.attr, Attr):
1.11 + self.context = context or attr.parent
1.12 + else:
1.13 + self.context = context
1.14
1.15 def __repr__(self):
1.16 if self.attr is not None:
1.17 @@ -114,10 +118,13 @@
1.18
1.19 # Instructions operating on the value stack.
1.20
1.21 -class LoadConst(StackAdd, Address): "Load the constant, class, function, module from the specified location."
1.22 class Duplicate(StackAdd, Instruction): "Duplicate the top of the stack."
1.23 class Pop(StackRemove, Immediate): "Pop entries from the top of the stack."
1.24
1.25 +# Access to stored constant data.
1.26 +
1.27 +class LoadConst(StackAdd, Address): "Load the constant, class, function, module from the specified location."
1.28 +
1.29 # Access within an invocation frame.
1.30
1.31 class LoadName(StackAdd, SR): "Load the object from the given local attribute/variable."
1.32 @@ -127,8 +134,7 @@
1.33
1.34 # Access to address-relative data.
1.35
1.36 -class MakeObject(StackAdd, Instruction): "Make a new object."
1.37 -# ... DropObject not defined: Assume garbage collection.
1.38 +class MakeObject(StackAdd, Instruction): "Make a new object. There isn't a complementary DropObject."
1.39 class LoadAttr(AR): "Load the object from the given attribute."
1.40 class StoreAttr(StackRemove2, AR): "Store an object in the given attribute."
1.41 class LoadAttrIndex(Immediate): "Load the object for the attribute with the given index."