mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-28 12:32:27 +08:00
Switch to v:t_ variables for type checks
This commit is contained in:
@@ -79,7 +79,7 @@ function! ale#util#GetLineCount(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#util#GetFunction(string_or_ref) abort
|
||||
if type(a:string_or_ref) == type('')
|
||||
if type(a:string_or_ref) is v:t_string
|
||||
return function(a:string_or_ref)
|
||||
endif
|
||||
|
||||
@@ -303,8 +303,8 @@ endfunction
|
||||
" Only the first pattern which matches a line will be returned.
|
||||
function! ale#util#GetMatches(lines, patterns) abort
|
||||
let l:matches = []
|
||||
let l:lines = type(a:lines) == type([]) ? a:lines : [a:lines]
|
||||
let l:patterns = type(a:patterns) == type([]) ? a:patterns : [a:patterns]
|
||||
let l:lines = type(a:lines) is v:t_list ? a:lines : [a:lines]
|
||||
let l:patterns = type(a:patterns) is v:t_list ? a:patterns : [a:patterns]
|
||||
|
||||
for l:line in l:lines
|
||||
for l:pattern in l:patterns
|
||||
@@ -382,7 +382,7 @@ function! ale#util#FuzzyJSONDecode(data, default) abort
|
||||
return a:default
|
||||
endif
|
||||
|
||||
let l:str = type(a:data) == type('') ? a:data : join(a:data, '')
|
||||
let l:str = type(a:data) is v:t_string ? a:data : join(a:data, '')
|
||||
|
||||
try
|
||||
let l:result = json_decode(l:str)
|
||||
|
||||
Reference in New Issue
Block a user