Patch 9.0.0219

4 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 16, 2022, 11:10:41 AM8/16/22
to vim...@googlegroups.com

Patch 9.0.0219
Problem: Cannot make a funcref with "s:func" in a def function in legacy
script.
Solution: Allow for using a lower case function name after "s:". (Kota Kato,
closes #10926)
Files: src/userfunc.c, src/vim9expr.c, src/testdir/test_vim9_func.vim


*** ../vim-9.0.0218/src/userfunc.c 2022-07-29 19:50:38.277964080 +0100
--- src/userfunc.c 2022-08-16 15:27:33.483100466 +0100
***************
*** 3995,4001 ****
{
if (!vim9_local)
{
! if (vim9script && lead == 2 && !ASCII_ISUPPER(*lv.ll_name))
{
semsg(_(e_function_name_must_start_with_capital_str), start);
goto theend;
--- 3995,4002 ----
{
if (!vim9_local)
{
! if (vim9script && lead == 2 && !ASCII_ISUPPER(*lv.ll_name)
! && current_script_is_vim9())
{
semsg(_(e_function_name_must_start_with_capital_str), start);
goto theend;
*** ../vim-9.0.0218/src/vim9expr.c 2022-05-25 19:02:22.000000000 +0100
--- src/vim9expr.c 2022-08-16 15:44:39.570794370 +0100
***************
*** 8,14 ****
*/

/*
! * vim9cmds.c: Dealing with compiled function expressions
*/

#define USING_FLOAT_STUFF
--- 8,14 ----
*/

/*
! * vim9expr.c: Dealing with compiled function expressions
*/

#define USING_FLOAT_STUFF
***************
*** 451,458 ****
vim_free(name);
return FAIL;
}
! if (is_expr && ASCII_ISUPPER(*name)
! && find_func(name, FALSE) != NULL)
res = generate_funcref(cctx, name, FALSE);
else
res = compile_load_scriptvar(cctx, name,
--- 451,457 ----
vim_free(name);
return FAIL;
}
! if (is_expr && find_func(name, FALSE) != NULL)
res = generate_funcref(cctx, name, FALSE);
else
res = compile_load_scriptvar(cctx, name,
*** ../vim-9.0.0218/src/testdir/test_vim9_func.vim 2022-08-08 21:43:06.990412767 +0100
--- src/testdir/test_vim9_func.vim 2022-08-16 15:50:07.483475956 +0100
***************
*** 1957,1962 ****
--- 1957,2001 ----
g:listarg->assert_equal([1, 2, 3])
END
v9.CheckScriptSuccess(lines)
+
+ lines =<< trim END
+ function s:func(num)
+ return a:num * 2
+ endfunction
+
+ def s:CallFuncref()
+ var Funcref = function('s:func')
+ Funcref(3)->assert_equal(6)
+ enddef
+ call s:CallFuncref()
+ END
+ v9.CheckScriptSuccess(lines)
+
+ lines =<< trim END
+ function s:func(num)
+ return a:num * 2
+ endfunction
+
+ def s:CallFuncref()
+ var Funcref = function(s:func)
+ Funcref(3)->assert_equal(6)
+ enddef
+ call s:CallFuncref()
+ END
+ v9.CheckScriptSuccess(lines)
+
+ lines =<< trim END
+ function s:func(num)
+ return a:num * 2
+ endfunction
+
+ def s:CallFuncref()
+ var Funcref = s:func
+ Funcref(3)->assert_equal(6)
+ enddef
+ call s:CallFuncref()
+ END
+ v9.CheckScriptSuccess(lines)
enddef

let SomeFunc = function('len')
*** ../vim-9.0.0218/src/version.c 2022-08-16 14:51:49.442515641 +0100
--- src/version.c 2022-08-16 15:46:57.655154157 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 219,
/**/

--
WOMAN: King of the who?
ARTHUR: The Britons.
WOMAN: Who are the Britons?
ARTHUR: Well, we all are. we're all Britons and I am your king.
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages