diff options
author | w0rp <devw0rp@gmail.com> | 2018-07-25 01:27:28 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-07-25 01:27:28 +0100 |
commit | 06132954b12ba87c7bba8fb7d5a40e4ff8b774e8 (patch) | |
tree | 05c07fb32c7082d5c194d635c33bde30d4b5ac66 /autoload/ale/linter.vim | |
parent | 9f8c37e17c053772a83619a949d8eef639968b24 (diff) | |
download | ale-06132954b12ba87c7bba8fb7d5a40e4ff8b774e8.zip |
Switch to v:t_ variables for type checks
Diffstat (limited to 'autoload/ale/linter.vim')
-rw-r--r-- | autoload/ale/linter.vim | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim index aa602f7e..683d506a 100644 --- a/autoload/ale/linter.vim +++ b/autoload/ale/linter.vim @@ -57,11 +57,11 @@ function! ale#linter#GetLintersLoaded() abort endfunction function! s:IsCallback(value) abort - return type(a:value) == type('') || type(a:value) == type(function('type')) + return type(a:value) is v:t_string || type(a:value) is v:t_func endfunction function! s:IsBoolean(value) abort - return type(a:value) == type(0) && (a:value == 0 || a:value == 1) + return type(a:value) is v:t_number && (a:value == 0 || a:value == 1) endfunction function! s:LanguageGetter(buffer) dict abort @@ -69,7 +69,7 @@ function! s:LanguageGetter(buffer) dict abort endfunction function! ale#linter#PreProcess(filetype, linter) abort - if type(a:linter) != type({}) + if type(a:linter) isnot v:t_dict throw 'The linter object must be a Dictionary' endif @@ -79,7 +79,7 @@ function! ale#linter#PreProcess(filetype, linter) abort \ 'lsp': get(a:linter, 'lsp', ''), \} - if type(l:obj.name) != type('') + if type(l:obj.name) isnot v:t_string throw '`name` must be defined to name the linter' endif @@ -114,7 +114,7 @@ function! ale#linter#PreProcess(filetype, linter) abort elseif has_key(a:linter, 'executable') let l:obj.executable = a:linter.executable - if type(l:obj.executable) != type('') + if type(l:obj.executable) isnot v:t_string throw '`executable` must be a string if defined' endif else @@ -130,7 +130,7 @@ function! ale#linter#PreProcess(filetype, linter) abort elseif has_key(a:linter, 'command_chain') let l:obj.command_chain = a:linter.command_chain - if type(l:obj.command_chain) != type([]) + if type(l:obj.command_chain) isnot v:t_list throw '`command_chain` must be a List' endif @@ -148,7 +148,7 @@ function! ale#linter#PreProcess(filetype, linter) abort endif if has_key(l:link, 'output_stream') - if type(l:link.output_stream) != type('') + if type(l:link.output_stream) isnot v:t_string \|| index(['stdout', 'stderr', 'both'], l:link.output_stream) < 0 throw l:err_prefix . '`output_stream` flag must be ' \ . "'stdout', 'stderr', or 'both'" @@ -170,7 +170,7 @@ function! ale#linter#PreProcess(filetype, linter) abort elseif has_key(a:linter, 'command') let l:obj.command = a:linter.command - if type(l:obj.command) != type('') + if type(l:obj.command) isnot v:t_string throw '`command` must be a string if defined' endif else @@ -217,7 +217,7 @@ function! ale#linter#PreProcess(filetype, linter) abort " Default to using the filetype as the language. let l:obj.language = get(a:linter, 'language', a:filetype) - if type(l:obj.language) != type('') + if type(l:obj.language) isnot v:t_string throw '`language` must be a string' endif @@ -257,7 +257,7 @@ function! ale#linter#PreProcess(filetype, linter) abort let l:obj.output_stream = get(a:linter, 'output_stream', 'stdout') - if type(l:obj.output_stream) != type('') + if type(l:obj.output_stream) isnot v:t_string \|| index(['stdout', 'stderr', 'both'], l:obj.output_stream) < 0 throw "`output_stream` must be 'stdout', 'stderr', or 'both'" endif @@ -283,8 +283,8 @@ function! ale#linter#PreProcess(filetype, linter) abort let l:obj.aliases = get(a:linter, 'aliases', []) - if type(l:obj.aliases) != type([]) - \|| len(filter(copy(l:obj.aliases), 'type(v:val) != type('''')')) > 0 + if type(l:obj.aliases) isnot v:t_list + \|| len(filter(copy(l:obj.aliases), 'type(v:val) isnot v:t_string')) > 0 throw '`aliases` must be a List of String values' endif @@ -336,7 +336,7 @@ function! s:GetAliasedFiletype(original_filetype) abort let l:buffer_aliases = get(b:, 'ale_linter_aliases', {}) " b:ale_linter_aliases can be set to a List. - if type(l:buffer_aliases) is type([]) + if type(l:buffer_aliases) is v:t_list return l:buffer_aliases endif @@ -360,7 +360,7 @@ endfunction function! ale#linter#ResolveFiletype(original_filetype) abort let l:filetype = s:GetAliasedFiletype(a:original_filetype) - if type(l:filetype) != type([]) + if type(l:filetype) isnot v:t_list return [l:filetype] endif @@ -376,7 +376,7 @@ function! s:GetLinterNames(original_filetype) abort endif " b:ale_linters can be set to a List. - if type(l:buffer_ale_linters) is type([]) + if type(l:buffer_ale_linters) is v:t_list return l:buffer_ale_linters endif @@ -414,9 +414,9 @@ function! ale#linter#Get(original_filetypes) abort let l:all_linters = ale#linter#GetAll(l:filetype) let l:filetype_linters = [] - if type(l:linter_names) == type('') && l:linter_names is# 'all' + if type(l:linter_names) is v:t_string && l:linter_names is# 'all' let l:filetype_linters = l:all_linters - elseif type(l:linter_names) == type([]) + elseif type(l:linter_names) is v:t_list " Select only the linters we or the user has specified. for l:linter in l:all_linters let l:name_list = [l:linter.name] + l:linter.aliases |