util: use finish to skip the vim9 script part
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v8.2.1000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
reviewdog / runner / vint (push) Has been cancelled

Also drop the Vim9 script implementation of airline#util#exec_funcrefs(),
because it will try to find script-local funcrefs, and thus errors out.

fixes: #2753

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2026-05-31 14:12:15 +00:00
parent c05ddf470d
commit d842cfb9dd
+28 -34
View File
@@ -21,6 +21,31 @@ function! airline#util#has_vim9_script()
\ get(g:, "airline_experimental", 0))
endfunction
if v:version >= 704
function! airline#util#exec_funcrefs(list, ...)
for Fn in a:list
let code = call(Fn, a:000)
if code != 0
return code
endif
endfor
return 0
endfunction
else
function! airline#util#exec_funcrefs(list, ...)
" for 7.2; we cannot iterate the list, hence why we use range()
" for 7.3-[97, 328]; we cannot reuse the variable, hence the {}
for i in range(0, len(a:list) - 1)
let Fn{i} = a:list[i]
let code = call(Fn{i}, a:000)
if code != 0
return code
endif
endfor
return 0
endfunction
endif
if !exists(":def") || !airline#util#has_vim9_script()
" TODO: Try to cache winwidth(0) function
" e.g. store winwidth per window and access that, only update it, if the size
@@ -100,30 +125,6 @@ if !exists(":def") || !airline#util#has_vim9_script()
endfunction
endif
if v:version >= 704
function! airline#util#exec_funcrefs(list, ...)
for Fn in a:list
let code = call(Fn, a:000)
if code != 0
return code
endif
endfor
return 0
endfunction
else
function! airline#util#exec_funcrefs(list, ...)
" for 7.2; we cannot iterate the list, hence why we use range()
" for 7.3-[97, 328]; we cannot reuse the variable, hence the {}
for i in range(0, len(a:list) - 1)
let Fn{i} = a:list[i]
let code = call(Fn{i}, a:000)
if code != 0
return code
endif
endfor
return 0
endfunction
endif
" Compatibility wrapper for strchars, in case this vim version does not
" have it natively
@@ -257,6 +258,9 @@ if !exists(":def") || !airline#util#has_vim9_script()
\ get(g:, "airline_multiline", 0))
endfunction
" End legacy Vim Script
finish
else
def airline#util#winwidth(...args: list<any>): number
@@ -320,16 +324,6 @@ else
return getwinvar(winnr, key, def)
enddef
def airline#util#exec_funcrefs(list: list<any>, ...args: list<any>): number
for Fn in list
var code = call(Fn, args)
if code != 0
return code
endif
endfor
return 0
enddef
def airline#util#strchars(str: string): number
if s:has_strchars
return strchars(str)