Patch 8.2.4174

2 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 21, 2022, 3:37:37 PMJan 21
to vim...@googlegroups.com

Patch 8.2.4174
Problem: Vim9: can use an autoload name in normal script.
Solution: Disallow using an autoload name.
Files: src/userfunc.c, src/errors.h, src/testdir/test_vim9_import.vim


*** ../vim-8.2.4173/src/userfunc.c 2022-01-21 13:29:52.479888865 +0000
--- src/userfunc.c 2022-01-21 20:10:22.096524040 +0000
***************
*** 4495,4500 ****
--- 4495,4506 ----
}
}
}
+ else if (vim9script && vim_strchr(name, AUTOLOAD_CHAR) != NULL)
+ {
+ semsg(_(e_using_autoload_name_in_non_autoload_script_str),
+ name);
+ goto erret;
+ }
}
if (var_conflict)
{
*** ../vim-8.2.4173/src/errors.h 2022-01-20 21:32:50.331303977 +0000
--- src/errors.h 2022-01-21 20:10:27.344439308 +0000
***************
*** 3209,3215 ****
INIT(= N_("E1261: Cannot import .vim without using \"as\""));
EXTERN char e_cannot_import_same_script_twice_str[]
INIT(= N_("E1262: Cannot import the same script twice: %s"));
! // E1263 unused
EXTERN char e_autoload_import_cannot_use_absolute_or_relative_path[]
INIT(= N_("E1264: Autoload import cannot use absolute or relative path: %s"));
EXTERN char e_cannot_use_partial_here[]
--- 3209,3216 ----
INIT(= N_("E1261: Cannot import .vim without using \"as\""));
EXTERN char e_cannot_import_same_script_twice_str[]
INIT(= N_("E1262: Cannot import the same script twice: %s"));
! EXTERN char e_using_autoload_name_in_non_autoload_script_str[]
! INIT(= N_("E1263: Using autoload name in a non-autoload script: %s"));
EXTERN char e_autoload_import_cannot_use_absolute_or_relative_path[]
INIT(= N_("E1264: Autoload import cannot use absolute or relative path: %s"));
EXTERN char e_cannot_use_partial_here[]
*** ../vim-8.2.4173/src/testdir/test_vim9_import.vim 2022-01-21 16:31:06.299109897 +0000
--- src/testdir/test_vim9_import.vim 2022-01-21 20:19:02.219558129 +0000
***************
*** 1622,1627 ****
--- 1622,1639 ----
delete('Xdir', 'rf')
enddef

+ def Test_autoload_name_wring()
+ var lines =<< trim END
+ vim9script
+ def Xscriptname#Func()
+ enddef
+ END
+ writefile(lines, 'Xscriptname.vim')
+ CheckScriptFailure(lines, 'E1263:')
+
+ delete('Xscriptname')
+ enddef
+
def Test_import_autoload_postponed()
mkdir('Xdir/autoload', 'p')
var save_rtp = &rtp
*** ../vim-8.2.4173/src/version.c 2022-01-21 16:31:06.299109897 +0000
--- src/version.c 2022-01-21 20:17:03.709678736 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4174,
/**/

--
ARTHUR: Go on, Bors, chop its head off.
BORS: Right. Silly little bleeder. One rabbit stew coming up.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// 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