Skip to content

Commit

Permalink
Async.Promise: Prefer is v:null to == type(v:null)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Dec 31, 2017
1 parent b8770b7 commit fbed16a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions autoload/vital/__vital__/Async/Promise.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ let s:FULFILLED = 1
let s:REJECTED = 2

let s:DICT_T = type({})
let s:NULL_T = type(v:null)

" @vimlint(EVL103, 1, a:resolve)
" @vimlint(EVL103, 1, a:reject)
Expand Down Expand Up @@ -37,7 +36,7 @@ endfunction

" ... is added to use this function as a callback of timer_start()
function! s:_invoke_callback(settled, promise, callback, result, ...) abort
let has_callback = type(a:callback) != s:NULL_T
let has_callback = a:callback isnot v:null
let success = 1
let err = v:null
if has_callback
Expand Down Expand Up @@ -86,7 +85,7 @@ function! s:_publish(promise, ...) abort
let l:CB = a:promise._rejections[i]
endif
let child = a:promise._children[i]
if type(child) != s:NULL_T
if child isnot v:null
call s:_invoke_callback(settled, child, l:CB, a:promise._result)
else
call l:CB(a:promise._result)
Expand Down

0 comments on commit fbed16a

Please sign in to comment.