1.1 --- a/rsvp.py Mon Jun 01 02:41:57 2009 +0200
1.2 +++ b/rsvp.py Mon Jun 01 21:10:47 2009 +0200
1.3 @@ -387,7 +387,7 @@
1.4 self.value = self.operand, self.operand
1.5
1.6 def LoadFunction(self):
1.7 - self.value = None, self.operand # context of constant is not interesting
1.8 + self.value = None, self.operand
1.9
1.10 def LoadName(self):
1.11 frame = self.local_sp_stack[-1]
1.12 @@ -523,7 +523,7 @@
1.13 # NOTE: Need to ensure correct positioning where a context has been generated.
1.14 param_index, offset = element
1.15 if param_index == self.operand:
1.16 - self.frame_stack[frame + offset + 1] = self.source # add 1 to skip the context always generated
1.17 + self.frame_stack[frame + offset] = self.source
1.18 else:
1.19 self.exception = self._MakeObject(2, self.type_error_instance)
1.20 return self.RaiseException()
1.21 @@ -548,16 +548,16 @@
1.22 def CheckContext(self):
1.23 self.status = self.value[1] is not None
1.24
1.25 - def CheckClassContext(self):
1.26 - context_context, context_ref = self.value
1.27 - context_data = self.load(context_ref)
1.28 + def CheckClass(self):
1.29 + context, ref = self.value
1.30 + data = self.load(ref)
1.31
1.32 # Classes are not themselves usable as the self argument.
1.33 # NOTE: This may change at some point.
1.34 # However, where classes appear as the context, instance
1.35 # compatibility is required in the first argument.
1.36
1.37 - self.status = context_data.attrcode is None # absent attrcode == class
1.38 + self.status = data.attrcode is None # absent attrcode == class
1.39
1.40 def CheckFrame(self):
1.41 (nargs, ndefaults, has_star) = self.operand
1.42 @@ -568,8 +568,11 @@
1.43 frame = self.local_sp_stack[-1]
1.44 nlocals = len(self.frame_stack[frame:])
1.45
1.46 - if not ((nargs - ndefaults) <= nlocals and (nlocals <= nargs or has_star)):
1.47 - #raise Exception, "CheckFrame %r (%r <= %r <= %r)" % (self.operand, nargs - ndefaults, nlocals, nargs)
1.48 + # NOTE: Not testing (nlocals <= nargs or has_star) due to imprecise
1.49 + # NOTE: invocation frame removal (after frame adjustment).
1.50 +
1.51 + if not ((nargs - ndefaults) <= nlocals):
1.52 + raise Exception, "CheckFrame %r (%r <= %r <= %r)" % (self.operand, nargs - ndefaults, nlocals, nargs)
1.53 self.exception = self._MakeObject(2, self.type_error_instance)
1.54 return self.RaiseException()
1.55
1.56 @@ -596,11 +599,11 @@
1.57
1.58 def CheckSelf(self):
1.59 context, ref = self.value
1.60 - target_context, target_ref = self.source
1.61 + context_context, context_ref = self.source
1.62
1.63 # Check the details of the proposed context and the target's context.
1.64
1.65 - self.status = self._CheckInstance(ref, target_context)
1.66 + self.status = self._CheckInstance(ref, context_ref)
1.67
1.68 def JumpInFrame(self):
1.69 codeaddr = self.callable
1.70 @@ -620,7 +623,7 @@
1.71 self.frame_stack.extend([None] * self.operand)
1.72
1.73 def AdjustFrame(self):
1.74 - self.local_sp_stack[-1] += self.operand
1.75 + self.invocation_sp_stack[-1] += self.operand
1.76
1.77 def Return(self):
1.78 return self.pull_pc()