diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-09 21:47:10 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-04-09 21:47:10 +0200 |
commit | 9a91d2b72c20f213bbf77f27b7edd01e0e43d5e0 (patch) | |
tree | a7eeb41a66f128f991990a2d5785684423306349 /src/userfunc.c | |
parent | 1af0fbf955f799392f614bc38f9d2fcbd9960526 (diff) |
patch 9.1.0287: Vim9: comment may be treated as heredoc startv9.1.0287
Problem: Vim9: comment may be treated as heredoc start.
(Ernie Rael)
Solution: Use skip_var_list() instead of find_name_end().
(zeertzjq)
fixes: #14444
closes: #14446
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/userfunc.c')
-rw-r--r-- | src/userfunc.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 1bd1a28459..015733cdb1 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -1227,12 +1227,20 @@ get_function_body( || checkforcmd(&arg, "const", 5) || vim9_function) { - while (vim_strchr((char_u *)"$@&", *arg) != NULL) - ++arg; - arg = skipwhite(find_name_end(arg, NULL, NULL, - FNE_INCL_BR | FNE_ALLOW_CURLY)); - if (vim9_function && *arg == ':') - arg = skipwhite(skip_type(skipwhite(arg + 1), FALSE)); + int save_sc_version = current_sctx.sc_version; + int var_count = 0; + int semicolon = 0; + char_u *argend; + + current_sctx.sc_version + = vim9_function ? SCRIPT_VERSION_VIM9 : 1; + argend = skip_var_list(arg, TRUE, &var_count, &semicolon, + TRUE); + if (argend == NULL) + // Invalid list assignment: skip to closing bracket. + argend = find_name_end(arg, NULL, NULL, FNE_INCL_BR); + arg = skipwhite(argend); + current_sctx.sc_version = save_sc_version; if (arg[0] == '=' && arg[1] == '<' && arg[2] =='<') { p = skipwhite(arg + 3); |