1.1 --- a/rsvp.py Sun May 17 23:50:20 2009 +0200
1.2 +++ b/rsvp.py Mon May 18 23:56:12 2009 +0200
1.3 @@ -484,7 +484,9 @@
1.4
1.5 def LoadContext(self):
1.6 context, ref = self.value
1.7 - self.value = None, context # context of context is not interesting
1.8 + # NOTE: Omission of the context of the context would make things like
1.9 + # NOTE: self() inside methods impossible.
1.10 + self.value = context, context
1.11
1.12 def CheckFrame(self):
1.13 (nargs, ndefaults, has_star) = self.operand
1.14 @@ -514,7 +516,9 @@
1.15 raise Exception, "CheckFrame %r (%r <= %r <= %r)" % (self.operand, nargs - ndefaults, nlocals, nargs)
1.16
1.17 def FillDefaults(self):
1.18 - (nargs, ndefaults) = self.operand
1.19 + # NOTE: Make the get_operand method of the instruction provide the
1.20 + # NOTE: function location.
1.21 + (nargs, ndefaults, fn) = self.operand
1.22
1.23 # The frame is actually installed as the locals.
1.24
1.25 @@ -527,6 +531,7 @@
1.26 default = nlocals - (nargs - ndefaults)
1.27 self.frame_stack.extend([None] * (nargs - nlocals))
1.28 pos = nlocals
1.29 + ref = fn.location
1.30
1.31 while pos < nargs:
1.32 self.frame_stack[frame + pos] = self.load(ref + default + 1) # skip header