Patch 8.2.3807
Problem:    Vim9: can call import with star directly.
Solution:   Check that the import used star.
Files:      src/userfunc.c, src/eval.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.3806/src/userfunc.c      2021-12-13 19:14:48.597409503 +0000
--- src/userfunc.c      2021-12-14 12:02:04.650038528 +0000
***************
*** 1596,1602 ****
                *lenp = (int)STRLEN(s);
                return s;
            }
!           // TODO: what if (import->imp_flags & IMP_FLAGS_STAR)
            {
                scriptitem_T    *si = SCRIPT_ITEM(import->imp_sid);
                svar_T          *sv = ((svar_T *)si->sn_var_vals.ga_data)
--- 1596,1611 ----
                *lenp = (int)STRLEN(s);
                return s;
            }
!           if (import->imp_flags & IMP_FLAGS_STAR)
!           {
!               name[len] = NUL;
!               semsg(_(e_cannot_use_str_itself_it_is_imported_with_star),
!                                                                        name);
!               name[len] = cc;
!               *lenp = 0;
!               return (char_u *)"";    // just in case
!           }
!           else
            {
                scriptitem_T    *si = SCRIPT_ITEM(import->imp_sid);
                svar_T          *sv = ((svar_T *)si->sn_var_vals.ga_data)
*** ../vim-8.2.3806/src/eval.c  2021-12-13 14:26:40.992627753 +0000
--- src/eval.c  2021-12-14 11:56:06.134170616 +0000
***************
*** 2001,2007 ****
      // Need to make a copy, in case evaluating the arguments makes
      // the name invalid.
      s = vim_strsave(s);
!     if (s == NULL || (flags & EVAL_CONSTANT))
        ret = FAIL;
      else
      {
--- 2001,2007 ----
      // Need to make a copy, in case evaluating the arguments makes
      // the name invalid.
      s = vim_strsave(s);
!     if (s == NULL || *s == NUL || (flags & EVAL_CONSTANT))
        ret = FAIL;
      else
      {
*** ../vim-8.2.3806/src/testdir/test_vim9_script.vim    2021-12-11 
16:13:32.231721218 +0000
--- src/testdir/test_vim9_script.vim    2021-12-14 12:01:20.194057270 +0000
***************
*** 1536,1541 ****
--- 1536,1556 ----
    CheckScriptFailure(lines, 'E1047:')
  
    delete('Xfoo.vim')
+ 
+   lines =<< trim END
+       vim9script
+       def TheFunc()
+         echo 'the func'
+       enddef
+       export var Ref = TheFunc
+   END
+   writefile([], 'Xthat.vim')
+   lines =<< trim END
+       import * as That from './Xthat.vim'
+       That()
+   END
+   CheckDefAndScriptFailure2(lines, 'E1094:', 'E1236: Cannot use That itself')
+   delete('Xthat.vim')
  enddef
  
  def Test_import_as()
*** ../vim-8.2.3806/src/version.c       2021-12-14 11:16:26.814008783 +0000
--- src/version.c       2021-12-14 11:52:54.706217009 +0000
***************
*** 751,752 ****
--- 751,754 ----
  {   /* Add new patch number below this line */
+ /**/
+     3807,
  /**/

-- 
Give a man a computer program and you give him a headache,
but teach him to program computers and you give him the power
to create headaches for others for the rest of his life...
        R. B. Forest

 /// 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/20211214120810.AC5B21C014A%40moolenaar.net.

Raspunde prin e-mail lui