Patch 8.2.1789
Problem:    Vim9: crash with invalid list constant. (Dhiraj Mishra)
Solution:   Return FAIL when compiling the list fails. (closes #7066)
Files:      src/vim9compile.c, src/errors.h, src/testdir/test_vim9_expr.vim


*** ../vim-8.2.1788/src/vim9compile.c   2020-09-27 21:27:36.490544195 +0200
--- src/vim9compile.c   2020-10-03 13:38:40.735711826 +0200
***************
*** 2549,2555 ****
            break;
        }
        if (compile_expr0(&p, cctx) == FAIL)
!           break;
        ++count;
        if (*p == ',')
        {
--- 2549,2555 ----
            break;
        }
        if (compile_expr0(&p, cctx) == FAIL)
!           return FAIL;
        ++count;
        if (*p == ',')
        {
***************
*** 3333,3339 ****
--- 3333,3342 ----
  
            *arg = p + 1;
            if (may_get_next_line(*arg, arg, cctx) == FAIL)
+           {
+               emsg(_(e_missing_name_after_dot));
                return FAIL;
+           }
            // dictionary member: dict.name
            p = *arg;
            if (eval_isdictc(*p))
*** ../vim-8.2.1788/src/errors.h        2020-09-27 15:19:23.638118934 +0200
--- src/errors.h        2020-10-03 13:38:11.735794362 +0200
***************
*** 276,279 ****
--- 276,281 ----
        INIT(= N_("E1125: Final requires a value"));
  EXTERN char e_cannot_use_let_in_vim9_script[]
        INIT(= N_("E1126: Cannot use :let in Vim9 script"));
+ EXTERN char e_missing_name_after_dot[]
+       INIT(= N_("E1127: Missing name after dot"));
  #endif
*** ../vim-8.2.1788/src/testdir/test_vim9_expr.vim      2020-09-27 
22:47:01.880163387 +0200
--- src/testdir/test_vim9_expr.vim      2020-10-03 13:39:04.499644208 +0200
***************
*** 1538,1543 ****
--- 1538,1553 ----
    CheckDefExecFailure(["var l: list<number> = ['x', 234]"], 'E1012:', 1)
    CheckDefExecFailure(["var l: list<string> = [234, 'x']"], 'E1012:', 1)
    CheckDefExecFailure(["var l: list<string> = ['x', 123]"], 'E1012:', 1)
+ 
+   var lines =<< trim END
+       vim9script
+       var datalist: list<string>
+       def Main()
+         datalist += ['x'.
+       enddef
+       Main()
+   END
+   CheckScriptFailure(lines, 'E1127:')
  enddef
  
  def Test_expr7_list_vim9script()
*** ../vim-8.2.1788/src/version.c       2020-10-03 12:57:23.014572543 +0200
--- src/version.c       2020-10-03 13:41:12.003281132 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1789,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
17. When the money comes out the ATM, scream "I won!, I won! 3rd
    time this week!!!!!"

 /// 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/202010031153.093Brs5O1801417%40masaka.moolenaar.net.

Raspunde prin e-mail lui