Patch 8.2.0975
Problem:    Vim9: script variable does not accept optional s: prefix.
Solution:   Adjust the accepted syntax.
Files:      src/vim9script.c, src/testdir/test_vim9_script.vim


*** ../vim-8.2.0974/src/vim9script.c    2020-06-13 19:56:34.736416319 +0200
--- src/vim9script.c    2020-06-14 12:40:26.357316020 +0200
***************
*** 462,476 ****
        return arg + STRLEN(arg);
      }
  
!     for (p = arg + 1; *p != NUL && *p != ':' && eval_isnamec(*p);
!                                                                MB_PTR_ADV(p))
!       ;
  
      if (*p != ':')
      {
        emsg(_(e_type_req));
        return arg + STRLEN(arg);
      }
      name = vim_strnsave(arg, p - arg);
  
      // parse type
--- 462,481 ----
        return arg + STRLEN(arg);
      }
  
!     for (p = arg + 1; *p != NUL && eval_isnamec(*p); MB_PTR_ADV(p))
!       if (*p == ':' && p != arg + 1)
!           break;
  
      if (*p != ':')
      {
        emsg(_(e_type_req));
        return arg + STRLEN(arg);
      }
+     if (!VIM_ISWHITE(p[1]))
+     {
+       semsg(_(e_white_after), ":");
+       return arg + STRLEN(arg);
+     }
      name = vim_strnsave(arg, p - arg);
  
      // parse type
*** ../vim-8.2.0974/src/testdir/test_vim9_script.vim    2020-06-13 
19:00:06.887160162 +0200
--- src/testdir/test_vim9_script.vim    2020-06-14 12:41:19.329132085 +0200
***************
*** 1822,1834 ****
--- 1822,1845 ----
      g:var_uninit = var
      var = 'text'
      g:var_test = var
+     " prefixing s: is optional
+     s:var = 'prefixed'
+     g:var_prefixed = s:var
+ 
+     let s:other: number
+     other = 1234
+     g:other_var = other
    END
    CheckScriptSuccess(lines)
    assert_equal('', g:var_uninit)
    assert_equal('text', g:var_test)
+   assert_equal('prefixed', g:var_prefixed)
+   assert_equal(1234, g:other_var)
  
    unlet g:var_uninit
    unlet g:var_test
+   unlet g:var_prefixed
+   unlet g:other_var
  enddef
  
  def Test_let_type_check()
***************
*** 1838,1843 ****
--- 1849,1860 ----
      var = 1234
    END
    CheckScriptFailure(lines, 'E1013:')
+ 
+   lines =<< trim END
+     vim9script
+     let var:string
+   END
+   CheckScriptFailure(lines, 'E1069:')
  enddef
  
  def Test_forward_declaration()
*** ../vim-8.2.0974/src/version.c       2020-06-13 19:56:34.736416319 +0200
--- src/version.c       2020-06-14 12:37:38.825868483 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     975,
  /**/

-- 
WOMAN:   Dennis, there's some lovely filth down here.  Oh -- how d'you do?
ARTHUR:  How do you do, good lady.  I am Arthur, King of the Britons.
         Who's castle is that?
WOMAN:   King of the who?
                                  The Quest for the Holy Grail (Monty Python)

 /// 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/202006141050.05EAoqAu816918%40masaka.moolenaar.net.

Raspunde prin e-mail lui