Patch 8.2.2357
Problem:    Vim9: crash when parsing function return type fails.
Solution:   Bail out and set return type to "unknown". (closes #7685)
Files:      src/userfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.2356/src/userfunc.c      2021-01-08 22:24:16.467725889 +0100
--- src/userfunc.c      2021-01-15 18:55:17.947225612 +0100
***************
*** 3886,3891 ****
--- 3886,3897 ----
        {
            p = ret_type;
            fp->uf_ret_type = parse_type(&p, &fp->uf_type_list, TRUE);
+           if (fp->uf_ret_type == NULL)
+           {
+               fp->uf_ret_type = &t_void;
+               SOURCING_LNUM = lnum_save;
+               goto erret;
+           }
        }
        SOURCING_LNUM = lnum_save;
      }
*** ../vim-8.2.2356/src/testdir/test_vim9_func.vim      2021-01-10 
22:42:46.920847063 +0100
--- src/testdir/test_vim9_func.vim      2021-01-15 18:59:38.658602165 +0100
***************
*** 197,202 ****
--- 197,213 ----
    s:nothing->assert_equal(1)
  enddef
  
+ def Test_return_invalid()
+   var lines =<< trim END
+     vim9script
+     def Func(): invalid
+       return xxx
+     enddef
+     defcompile
+   END
+   CheckScriptFailure(lines, 'E1010:', 2)
+ enddef
+ 
  func Increment()
    let g:counter += 1
  endfunc
*** ../vim-8.2.2356/src/version.c       2021-01-15 18:04:40.102419940 +0100
--- src/version.c       2021-01-15 19:04:14.233946909 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2357,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
156. You forget your friend's name but not her e-mail address.

 /// 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/202101151805.10FI54fm040918%40masaka.moolenaar.net.

Raspunde prin e-mail lui