mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.2405: Vim9: no need to allow white space before "(" for :def
Problem: Vim9: no need to allow white space before "(" for :def. Solution: Give an error for stray white space. (issue #7734)
This commit is contained in:
@@ -116,6 +116,38 @@ def Test_missing_endfunc_enddef()
|
|||||||
CheckScriptFailure(lines, 'E126:', 2)
|
CheckScriptFailure(lines, 'E126:', 2)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_white_space_before_paren()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def Test ()
|
||||||
|
echo 'test'
|
||||||
|
enddef
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1068:', 2)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
func Test ()
|
||||||
|
echo 'test'
|
||||||
|
endfunc
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1068:', 2)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
def Test ()
|
||||||
|
echo 'test'
|
||||||
|
enddef
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1068:', 1)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
func Test ()
|
||||||
|
echo 'test'
|
||||||
|
endfunc
|
||||||
|
END
|
||||||
|
CheckScriptSuccess(lines)
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_enddef_dict_key()
|
def Test_enddef_dict_key()
|
||||||
var d = {
|
var d = {
|
||||||
enddef: 'x',
|
enddef: 'x',
|
||||||
|
@@ -3199,6 +3199,12 @@ define_function(exarg_T *eap, char_u *name_arg)
|
|||||||
p = vim_strchr(p, '(');
|
p = vim_strchr(p, '(');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((vim9script || eap->cmdidx == CMD_def) && VIM_ISWHITE(p[-1]))
|
||||||
|
{
|
||||||
|
semsg(_(e_no_white_space_allowed_before_str), "(");
|
||||||
|
goto ret_free;
|
||||||
|
}
|
||||||
|
|
||||||
// In Vim9 script only global functions can be redefined.
|
// In Vim9 script only global functions can be redefined.
|
||||||
if (vim9script && eap->forceit && !is_global)
|
if (vim9script && eap->forceit && !is_global)
|
||||||
{
|
{
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2405,
|
||||||
/**/
|
/**/
|
||||||
2404,
|
2404,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user