(self, args)
Execute jump for a RETURN.
Execute jump for a RETURN.
Execute jump for a RETURN .
def return_(self, args):
        """Execute jump for a RETURN."""
        jumpnum, = args
        try:
            pos, orig_runmode, handler = self.gosub_stack.pop()
        except IndexError:
            raise error.BASICError(error.RETURN_WITHOUT_GOSUB)
        # returning from ON (event) GOSUB, re-enable event
        if handler:
            # if stopped explicitly using STOP, we wouldn't have got here;
            # if STOP is run inside the trap, no effect. OFF in trap: event off.
            handler.stopped = False
        if jumpnum is None:
            # go back to position of GOSUB
            self.set_pointer(orig_runmode, pos)
            # ignore rest of statement ('GOSUB 100 LAH' works just fine..)
            # but NOT if we jumped for an event, as we might have jumped from anywhere!
            if not handler:
                self.get_codestream().skip_to(tk.END_STATEMENT)
        else:
            # jump to specified line number
            self.jump(jumpnum)
def return_ ( self , args ) : jumpnum , = args try : pos , orig_runmode , handler = self . gosub_stack . pop ( ) except IndexError : raise error . BASICError ( error . RETURN_WITHOUT_GOSUB ) # returning from ON (event) GOSUB, re-enable event if handler : # if stopped explicitly using STOP, we wouldn't have got here; # if STOP is run inside the trap, no effect. OFF in trap: event off. handler . stopped = False if jumpnum is None : # go back to position of GOSUB self . set_pointer ( orig_runmode , pos ) # ignore rest of statement ('GOSUB 100 LAH' works just fine..) # but NOT if we jumped for an event, as we might have jumped from anywhere! if not handler : self . get_codestream ( ) . skip_to ( tk . END_STATEMENT ) else : # jump to specified line number self . jump ( jumpnum )