Patch 8.2.2165
Problem:    Vim9: assignment to dict member does not work.
Solution:   Fix recognizing dict member. (closes #7484)
Files:      src/ex_docmd.c, src/eval.c, src/evalvars.c, src/vim.h


*** ../vim-8.2.2164/src/ex_docmd.c      2020-12-16 21:43:47.451181035 +0100
--- src/ex_docmd.c      2020-12-19 21:49:50.245262011 +0100
***************
*** 3332,3337 ****
--- 3332,3339 ----
  
                // When followed by "=" or "+=" then it is an assignment.
                ++emsg_silent;
+               if (*after == '.')
+                   after = skipwhite(after + 1);
                if (skip_expr(&after, NULL) == OK)
                    after = skipwhite(after);
                else
*** ../vim-8.2.2164/src/eval.c  2020-12-19 16:30:39.439810130 +0100
--- src/eval.c  2020-12-19 22:05:16.194721402 +0100
***************
*** 874,879 ****
--- 874,886 ----
      if (v == NULL)
        return NULL;
  
+     if (in_vim9script() && (flags & GLV_NO_DECL) == 0)
+     {
+       if (!quiet)
+           semsg(_(e_variable_already_declared), lp->ll_name);
+       return NULL;
+     }
+ 
      /*
       * Loop until no more [idx] or .key is following.
       */
*** ../vim-8.2.2164/src/evalvars.c      2020-12-19 16:30:39.439810130 +0100
--- src/evalvars.c      2020-12-19 22:06:29.130502929 +0100
***************
*** 1464,1470 ****
      {
        lval_T  lv;
  
!       p = get_lval(arg, tv, &lv, FALSE, FALSE, 0, FNE_CHECK_START);
        if (p != NULL && lv.ll_name != NULL)
        {
            if (endchars != NULL && vim_strchr(endchars,
--- 1464,1471 ----
      {
        lval_T  lv;
  
!       p = get_lval(arg, tv, &lv, FALSE, FALSE,
!               (flags & ASSIGN_NO_DECL) ? GLV_NO_DECL : 0, FNE_CHECK_START);
        if (p != NULL && lv.ll_name != NULL)
        {
            if (endchars != NULL && vim_strchr(endchars,
*** ../vim-8.2.2164/src/vim.h   2020-12-11 19:30:26.789393285 +0100
--- src/vim.h   2020-12-19 22:08:06.738208777 +0100
***************
*** 2536,2551 ****
  #define COPYID_MASK (~0x1)
  
  // Values for trans_function_name() argument:
! #define TFN_INT               1       // internal function name OK
! #define TFN_QUIET     2       // no error messages
! #define TFN_NO_AUTOLOAD       4       // do not use script autoloading
! #define TFN_NO_DEREF  8       // do not dereference a Funcref
! #define TFN_READ_ONLY 16      // will not change the var
  
  // Values for get_lval() flags argument:
  #define GLV_QUIET     TFN_QUIET       // no error messages
  #define GLV_NO_AUTOLOAD       TFN_NO_AUTOLOAD // do not use script autoloading
  #define GLV_READ_ONLY TFN_READ_ONLY   // will not change the var
  
  #define DO_NOT_FREE_CNT 99999 // refcount for dict or list that should not
                                // be freed.
--- 2536,2553 ----
  #define COPYID_MASK (~0x1)
  
  // Values for trans_function_name() argument:
! #define TFN_INT               0x01    // internal function name OK
! #define TFN_QUIET     0x02    // no error messages
! #define TFN_NO_AUTOLOAD       0x04    // do not use script autoloading
! #define TFN_NO_DEREF  0x08    // do not dereference a Funcref
! #define TFN_READ_ONLY 0x10    // will not change the var
! #define TFN_NO_DECL   0x20    // only used for GLV_NO_DECL
  
  // Values for get_lval() flags argument:
  #define GLV_QUIET     TFN_QUIET       // no error messages
  #define GLV_NO_AUTOLOAD       TFN_NO_AUTOLOAD // do not use script autoloading
  #define GLV_READ_ONLY TFN_READ_ONLY   // will not change the var
+ #define GLV_NO_DECL   TFN_NO_DECL     // assignment without :var or :let
  
  #define DO_NOT_FREE_CNT 99999 // refcount for dict or list that should not
                                // be freed.
*** ../vim-8.2.2164/src/version.c       2020-12-19 21:23:38.797667072 +0100
--- src/version.c       2020-12-19 21:51:22.929041566 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2165,
  /**/

-- 
Are leaders born or made?  And if they're made, can we return them under
warranty?
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202012192110.0BJLAtUL1687863%40masaka.moolenaar.net.

Raspunde prin e-mail lui