Patch 9.0.0920
Problem:    Cannot find an import prefixed with "s:". (Doug Kearns)
Solution:   Skip over the "s:". (closes #11585)
Files:      src/vim9compile.c, src/testdir/test_vim9_import.vim


*** ../vim-9.0.0919/src/vim9compile.c   2022-10-21 12:05:41.918401161 +0100
--- src/vim9compile.c   2022-11-22 18:05:29.990270832 +0000
***************
*** 656,667 ****
      imported_T *
  find_imported(char_u *name, size_t len, int load)
  {
-     imported_T            *ret;
- 
      if (!SCRIPT_ID_VALID(current_sctx.sc_sid))
        return NULL;
  
!     ret = find_imported_in_script(name, len, current_sctx.sc_sid);
      if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD))
      {
        scid_T  actual_sid = 0;
--- 656,669 ----
      imported_T *
  find_imported(char_u *name, size_t len, int load)
  {
      if (!SCRIPT_ID_VALID(current_sctx.sc_sid))
        return NULL;
  
!     // Skip over "s:" before "s:something" to find the import name.
!     int off = name[0] == 's' && name[1] == ':' ? 2 : 0;
! 
!     imported_T *ret = find_imported_in_script(name + off, len - off,
!                                                         current_sctx.sc_sid);
      if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD))
      {
        scid_T  actual_sid = 0;
*** ../vim-9.0.0919/src/testdir/test_vim9_import.vim    2022-10-15 
20:06:30.284328833 +0100
--- src/testdir/test_vim9_import.vim    2022-11-22 18:10:23.146027290 +0000
***************
*** 2034,2039 ****
--- 2034,2048 ----
    source Xlegacy_script.vim
    assert_equal('global', g:global)
    unlet g:global
+ 
+   legacy_lines =<< trim END
+     import './Xvim9_script.vim'
+     let g:global = s:Xvim9_script.GetText()
+   END
+   writefile(legacy_lines, 'Xlegacyimport.vim', 'D')
+   source Xlegacyimport.vim
+   assert_equal('text', g:global)
+   unlet g:global
  enddef
  
  def Test_import_vim9_from_legacy()
*** ../vim-9.0.0919/src/version.c       2022-11-22 13:29:16.838832864 +0000
--- src/version.c       2022-11-22 17:59:13.494668856 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     920,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
110. You actually volunteer to become your employer's webmaster.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20221122181309.35D531C211B%40moolenaar.net.

Raspunde prin e-mail lui