Patch 8.2.1503
Problem: Vim9: error for an autocmd defined in a :def function in legacy
Vim script.
Solution: Don't check the variable type. (closes #6758)
Files: src/vim9script.c, src/testdir/test_vim9_script.vim
*** ../vim-8.2.1502/src/vim9script.c 2020-08-15 16:33:24.497747330 +0200
--- src/vim9script.c 2020-08-21 21:48:04.938151659 +0200
***************
*** 564,569 ****
--- 564,573 ----
scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
int idx;
+ if (si->sn_version != SCRIPT_VERSION_VIM9)
+ // legacy script doesn't store variable types
+ return OK;
+
// Find the svar_T in sn_var_vals.
for (idx = 0; idx < si->sn_var_vals.ga_len; ++idx)
{
*** ../vim-8.2.1502/src/testdir/test_vim9_script.vim 2020-08-21
21:32:45.502762790 +0200
--- src/testdir/test_vim9_script.vim 2020-08-21 21:53:55.072204078 +0200
***************
*** 3166,3171 ****
--- 3166,3188 ----
&rtp = save_rtp
enddef
+ def Test_script_var_in_autocmd()
+ # using a script variable from an autocommand, defined in a :def function
in a
+ # legacy Vim script, cannot check the variable type.
+ let lines =<< trim END
+ let s:counter = 1
+ def s:Func()
+ au! CursorHold
+ au CursorHold * s:counter += 1
+ enddef
+ call s:Func()
+ doau CursorHold
+ call assert_equal(2, s:counter)
+ au! CursorHold
+ END
+ CheckScriptSuccess(lines)
+ enddef
+
def Test_cmdline_win()
# if the Vim syntax highlighting uses Vim9 constructs they can be used from
# the command line window.
*** ../vim-8.2.1502/src/version.c 2020-08-21 21:32:45.506762771 +0200
--- src/version.c 2020-08-21 21:54:02.224165772 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1503,
/**/
--
hundred-and-one symptoms of being an internet addict:
257. Your "hundred-and-one" lists include well over 101 items, since you
automatically interpret all numbers in hexadecimal notation.
(hex 101 = decimal 257)
/// 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/202008211956.07LJuZuN543969%40masaka.moolenaar.net.