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
+7 -7
View File
@@ -245,32 +245,32 @@ function! ale#fix#registry#Add(name, func, filetypes, desc, ...) abort
" This command will throw from the sandbox.
let &equalprg=&equalprg
if type(a:name) != type('')
if type(a:name) isnot v:t_string
throw '''name'' must be a String'
endif
if type(a:func) != type('')
if type(a:func) isnot v:t_string
throw '''func'' must be a String'
endif
if type(a:filetypes) != type([])
if type(a:filetypes) isnot v:t_list
throw '''filetypes'' must be a List'
endif
for l:type in a:filetypes
if type(l:type) != type('')
if type(l:type) isnot v:t_string
throw 'Each entry of ''filetypes'' must be a String'
endif
endfor
if type(a:desc) != type('')
if type(a:desc) isnot v:t_string
throw '''desc'' must be a String'
endif
let l:aliases = get(a:000, 0, [])
if type(l:aliases) != type([])
\|| !empty(filter(copy(l:aliases), 'type(v:val) != type('''')'))
if type(l:aliases) isnot v:t_list
\|| !empty(filter(copy(l:aliases), 'type(v:val) isnot v:t_string'))
throw '''aliases'' must be a List of String values'
endif