Switch to v:t_ variables for type checks

This commit is contained in:
w0rp
2018-07-25 01:27:28 +01:00
parent 9f8c37e17c
commit 06132954b1
17 changed files with 84 additions and 62 deletions

View File

@@ -275,7 +275,7 @@ function! s:RunJob(options) abort
if get(g:, 'ale_run_synchronously') == 1
" Run a command synchronously if this test option is set.
let l:output = systemlist(
\ type(l:command) == type([])
\ type(l:command) is v:t_list
\ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2])
\ : l:command
\)
@@ -313,10 +313,10 @@ function! s:RunFixer(options) abort
\ : call(l:Function, [l:buffer, copy(l:input)])
endif
if type(l:result) == type(0) && l:result == 0
if type(l:result) is v:t_number && l:result == 0
" When `0` is returned, skip this item.
let l:index += 1
elseif type(l:result) == type([])
elseif type(l:result) is v:t_list
let l:input = l:result
let l:index += 1
else
@@ -351,9 +351,9 @@ function! s:RunFixer(options) abort
endfunction
function! s:AddSubCallbacks(full_list, callbacks) abort
if type(a:callbacks) == type('')
if type(a:callbacks) is v:t_string
call add(a:full_list, a:callbacks)
elseif type(a:callbacks) == type([])
elseif type(a:callbacks) is v:t_list
call extend(a:full_list, a:callbacks)
else
return 0
@@ -365,7 +365,7 @@ endfunction
function! s:GetCallbacks(buffer, fixers) abort
if len(a:fixers)
let l:callback_list = a:fixers
elseif type(get(b:, 'ale_fixers')) is type([])
elseif type(get(b:, 'ale_fixers')) is v:t_list
" Lists can be used for buffer-local variables only
let l:callback_list = b:ale_fixers
else
@@ -396,7 +396,7 @@ function! s:GetCallbacks(buffer, fixers) abort
" Variables with capital characters are needed, or Vim will complain about
" funcref variables.
for l:Item in l:callback_list
if type(l:Item) == type('')
if type(l:Item) is v:t_string
let l:Func = ale#fix#registry#GetFunc(l:Item)
if !empty(l:Func)