Patch 8.2.2485
Problem:    When sourcing a script again the script version isn't reset.
Solution:   Set sn_version to one when sourcing a script again. Clear
            sn_save_cpo properly. (closes #7608)
Files:      src/scriptfile.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.2484/src/scriptfile.c    2021-01-11 22:16:26.543513760 +0100
--- src/scriptfile.c    2021-02-07 17:16:44.711602715 +0100
***************
*** 1319,1324 ****
--- 1319,1327 ----
            }
        // imports can be redefined once
        mark_imports_for_reload(sid);
+ 
+       // reset version, "vim9script" may have been added or removed.
+       si->sn_version = 1;
      }
      else
      {
***************
*** 1457,1463 ****
      if (si->sn_save_cpo != NULL)
      {
        set_option_value((char_u *)"cpo", 0L, si->sn_save_cpo, 0);
!       CLEAR_POINTER(si->sn_save_cpo);
      }
  
      restore_funccal();
--- 1460,1466 ----
      if (si->sn_save_cpo != NULL)
      {
        set_option_value((char_u *)"cpo", 0L, si->sn_save_cpo, 0);
!       VIM_CLEAR(si->sn_save_cpo);
      }
  
      restore_funccal();
*** ../vim-8.2.2484/src/testdir/test_vim9_script.vim    2021-02-07 
16:40:02.246812677 +0100
--- src/testdir/test_vim9_script.vim    2021-02-07 17:16:13.859701754 +0100
***************
*** 2207,2213 ****
    assert_equal('1_3_', result)
  
    var s = ''
!   while s == 'x' #{comment
    endwhile
  enddef
  
--- 2207,2213 ----
    assert_equal('1_3_', result)
  
    var s = ''
!   while s == 'x' #{comment}
    endwhile
  enddef
  
***************
*** 3155,3160 ****
--- 3155,3173 ----
    delete('Xsourced')
    delete('Xclose')
    delete('Xdone')
+ 
+   writefile(['vim9script'], 'XanotherScript')
+   set cpo=aABceFsMny>
+   edit XanotherScript
+   so %
+   assert_equal('aABceFsMny>', &cpo)
+   :1del
+   w
+   so %
+   assert_equal('aABceFsMny>', &cpo)
+ 
+   delete('XanotherScript')
+   set cpo&vim
  enddef
  
  
*** ../vim-8.2.2484/src/version.c       2021-02-07 16:40:02.246812677 +0100
--- src/version.c       2021-02-07 17:15:31.387838104 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2485,
  /**/

-- 
I still remember when I gave up Smoking, Drinking and Sex.  It was the
most *horrifying* hour of my life!

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202102071618.117GIdXP2884118%40masaka.moolenaar.net.

Raspunde prin e-mail lui