micropython

Change of rsvp.py

255:2c60577895f0
rsvp.py
     1.1 --- a/rsvp.py	Mon Jul 13 01:02:42 2009 +0200
     1.2 +++ b/rsvp.py	Tue Jul 14 00:37:04 2009 +0200
     1.3 @@ -127,6 +127,9 @@
     1.4          cls = self._get_class("__builtins__", "TypeError")
     1.5          self.type_error = cls.location
     1.6          self.type_error_instance = cls.instance_template_location
     1.7 +        cls = self.machine._get_class("__builtins__", "tuple")
     1.8 +        self.tuple_class = cls.location
     1.9 +        self.tuple_instance = cls.instance_template_location
    1.10  
    1.11          # Debugging attributes.
    1.12  
    1.13 @@ -615,6 +618,28 @@
    1.14              default += 1
    1.15              pos += 1
    1.16  
    1.17 +    def CopyExtra(self):
    1.18 +        start = self.operand
    1.19 +
    1.20 +        # The frame is the source of the extra arguments.
    1.21 +
    1.22 +        frame = self.local_sp_stack[-1]
    1.23 +        nlocals = len(self.frame_stack[frame:])
    1.24 +
    1.25 +        # Make a tuple to hold the arguments.
    1.26 +
    1.27 +        ref = self._MakeObject(nlocals - start + 1, self.tuple_instance)
    1.28 +
    1.29 +        extra = 0
    1.30 +        pos = start
    1.31 +
    1.32 +        while pos < nlocals:
    1.33 +            self.save(ref + extra + 1, self.frame_stack[frame + pos]) # skip header when storing
    1.34 +            extra += 1
    1.35 +            pos += 1
    1.36 +
    1.37 +        self.value = ref, ref
    1.38 +
    1.39      def CheckSelf(self):
    1.40          context, ref = self.value
    1.41          context_context, context_ref = self.source
    1.42 @@ -781,10 +806,10 @@
    1.43          cls = self.machine._get_class("__builtins__", "IndexError")
    1.44          self.index_error = cls.location
    1.45          self.index_error_instance = cls.instance_template_location
    1.46 -        cls = self.machine._get_class("__builtins__", "tuple")
    1.47 -        self.tuple_class = cls.location
    1.48  
    1.49 +        self.tuple_class = self.machine.tuple_class
    1.50          self.type_error_instance = self.machine.type_error_instance
    1.51 +
    1.52          self.frame_stack = self.machine.frame_stack
    1.53          self.local_sp_stack = self.machine.local_sp_stack
    1.54