Patch 8.2.1191
Problem: Vim9: crash when function calls itself.
Solution: Add status UF_COMPILING. (closes #6441)
Files: src/structs.h, src/vim9compile.c, src/testdir/test_vim9_func.vim
*** ../vim-8.2.1190/src/structs.h 2020-07-08 22:01:43.796114663 +0200
--- src/structs.h 2020-07-12 17:24:51.691558285 +0200
***************
*** 1539,1544 ****
--- 1539,1545 ----
typedef enum {
UF_NOT_COMPILED,
UF_TO_BE_COMPILED,
+ UF_COMPILING,
UF_COMPILED
} def_status_T;
*** ../vim-8.2.1190/src/vim9compile.c 2020-07-11 22:14:54.318422203 +0200
--- src/vim9compile.c 2020-07-12 17:23:38.179852468 +0200
***************
*** 6802,6807 ****
--- 6802,6809 ----
else if (add_def_function(ufunc) == FAIL)
return FAIL;
+ ufunc->uf_def_status = UF_COMPILING;
+
CLEAR_FIELD(cctx);
cctx.ctx_ufunc = ufunc;
cctx.ctx_lnum = -1;
*** ../vim-8.2.1190/src/testdir/test_vim9_func.vim 2020-07-11
22:14:54.318422203 +0200
--- src/testdir/test_vim9_func.vim 2020-07-12 17:29:45.978416910 +0200
***************
*** 999,1003 ****
--- 999,1015 ----
call delete('XTest_silent_echo')
endfunc
+ def Fibonacci(n: number): number
+ if n < 2
+ return n
+ else
+ return Fibonacci(n - 1) + Fibonacci(n - 2)
+ endif
+ enddef
+
+ def Test_recursive_call()
+ assert_equal(6765, Fibonacci(20))
+ enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
*** ../vim-8.2.1190/src/version.c 2020-07-12 17:07:01.024810908 +0200
--- src/version.c 2020-07-12 17:25:05.339504143 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1191,
/**/
--
hundred-and-one symptoms of being an internet addict:
14. You start introducing yourself as "Jim at I-I-Net dot net dot au"
/// 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/202007121531.06CFVYDT2522578%40masaka.moolenaar.net.