Merge pull request #23102 from zeertzjq/vim-8.2.1378

vim-patch:8.2.{1378,3856,4361,4373,4476}
This commit is contained in:
zeertzjq
2023-04-15 17:38:46 +08:00
committed by GitHub
8 changed files with 630 additions and 502 deletions

View File

@@ -3149,8 +3149,9 @@ static int eval7(char **arg, typval_T *rettv, evalarg_T *const evalarg, bool wan
ret = FAIL; ret = FAIL;
} else { } else {
const int flags = evalarg == NULL ? 0 : evalarg->eval_flags; const int flags = evalarg == NULL ? 0 : evalarg->eval_flags;
if (**arg == '(') { if (*skipwhite(*arg) == '(') {
// "name(..." recursive! // "name(..." recursive!
*arg = skipwhite(*arg);
ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL); ret = eval_func(arg, evalarg, s, len, rettv, flags, NULL);
} else if (evaluate) { } else if (evaluate) {
// get value of variable // get value of variable

File diff suppressed because it is too large Load Diff

View File

@@ -2561,7 +2561,7 @@ func Test_builtin_check()
call assert_fails('let l:.trim = {x -> " " .. x}', 'E704:') call assert_fails('let l:.trim = {x -> " " .. x}', 'E704:')
let lines =<< trim END let lines =<< trim END
vim9script vim9script
var s:trim = (x) => " " .. x var trim = (x) => " " .. x
END END
call CheckScriptFailure(lines, 'E704:') call CheckScriptFailure(lines, 'E704:')

View File

@@ -1598,11 +1598,11 @@ func Test_completefunc_callback()
bw! bw!
# Test for using a script-local function name # Test for using a script-local function name
def s:LocalCompleteFunc(findstart: number, base: string): any def LocalCompleteFunc(findstart: number, base: string): any
add(g:LocalCompleteFuncArgs, [findstart, base]) add(g:LocalCompleteFuncArgs, [findstart, base])
return findstart ? 0 : [] return findstart ? 0 : []
enddef enddef
&completefunc = s:LocalCompleteFunc &completefunc = LocalCompleteFunc
new | only new | only
setline(1, 'three') setline(1, 'three')
g:LocalCompleteFuncArgs = [] g:LocalCompleteFuncArgs = []
@@ -1855,11 +1855,11 @@ func Test_omnifunc_callback()
bw! bw!
# Test for using a script-local function name # Test for using a script-local function name
def s:LocalOmniFunc(findstart: number, base: string): any def LocalOmniFunc(findstart: number, base: string): any
add(g:LocalOmniFuncArgs, [findstart, base]) add(g:LocalOmniFuncArgs, [findstart, base])
return findstart ? 0 : [] return findstart ? 0 : []
enddef enddef
&omnifunc = s:LocalOmniFunc &omnifunc = LocalOmniFunc
new | only new | only
setline(1, 'three') setline(1, 'three')
g:LocalOmniFuncArgs = [] g:LocalOmniFuncArgs = []
@@ -2148,11 +2148,11 @@ func Test_thesaurusfunc_callback()
bw! bw!
# Test for using a script-local function name # Test for using a script-local function name
def s:LocalTsrFunc(findstart: number, base: string): any def LocalTsrFunc(findstart: number, base: string): any
add(g:LocalTsrFuncArgs, [findstart, base]) add(g:LocalTsrFuncArgs, [findstart, base])
return findstart ? 0 : [] return findstart ? 0 : []
enddef enddef
&thesaurusfunc = s:LocalTsrFunc &thesaurusfunc = LocalTsrFunc
new | only new | only
setline(1, 'three') setline(1, 'three')
g:LocalTsrFuncArgs = [] g:LocalTsrFuncArgs = []

View File

@@ -732,10 +732,10 @@ func Test_opfunc_callback()
bw! bw!
# Test for using a script-local function name # Test for using a script-local function name
def s:LocalOpFunc(type: string): void def LocalOpFunc(type: string): void
g:LocalOpFuncArgs = [type] g:LocalOpFuncArgs = [type]
enddef enddef
&opfunc = s:LocalOpFunc &opfunc = LocalOpFunc
g:LocalOpFuncArgs = [] g:LocalOpFuncArgs = []
normal! g@l normal! g@l
assert_equal(['char'], g:LocalOpFuncArgs) assert_equal(['char'], g:LocalOpFuncArgs)

View File

@@ -369,11 +369,11 @@ func Test_tagfunc_callback()
bw! bw!
# Test for using a script-local function name # Test for using a script-local function name
def s:LocalTagFunc(pat: string, flags: string, info: dict<any> ): any def LocalTagFunc(pat: string, flags: string, info: dict<any> ): any
g:LocalTagFuncArgs = [pat, flags, info] g:LocalTagFuncArgs = [pat, flags, info]
return null return null
enddef enddef
&tagfunc = s:LocalTagFunc &tagfunc = LocalTagFunc
new new
g:LocalTagFuncArgs = [] g:LocalTagFuncArgs = []
assert_fails('tag a12', 'E433:') assert_fails('tag a12', 'E433:')

View File

@@ -7267,7 +7267,7 @@ func Test_typed_script_var()
endfunc endfunc
" Test for issue6776 {{{1 " Test for issue6776 {{{1
func Test_trinary_expression() func Test_ternary_expression()
try try
call eval('0 ? 0') call eval('0 ? 0')
catch catch

View File

@@ -34,6 +34,14 @@ func CheckScriptSuccess(lines)
endtry endtry
endfunc endfunc
func CheckDefAndScriptSuccess(lines)
return
endfunc
func CheckDefAndScriptFailure(lines, error, lnum = -3)
return
endfunc
func CheckDefExecAndScriptFailure(lines, error, lnum = -3) func CheckDefExecAndScriptFailure(lines, error, lnum = -3)
return return
endfunc endfunc
@@ -85,6 +93,14 @@ func CheckTransLegacySuccess(lines)
call CheckLegacySuccess(legacylines) call CheckLegacySuccess(legacylines)
endfunc endfunc
func CheckTransDefSuccess(lines)
return
endfunc
func CheckTransVim9Success(lines)
return
endfunc
" Execute "lines" in a legacy function " Execute "lines" in a legacy function
" Use 'VAR' for a declaration. " Use 'VAR' for a declaration.
" Use 'LET' for an assignment " Use 'LET' for an assignment