From 8f6b8662bdab05246f88255e64b1908a8071a3cc Mon Sep 17 00:00:00 2001 From: rhysd Date: Wed, 27 Dec 2017 13:35:25 +0900 Subject: [PATCH] Async.Promise: Prefer v:t_* --- autoload/vital/__vital__/Async/Promise.vim | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/autoload/vital/__vital__/Async/Promise.vim b/autoload/vital/__vital__/Async/Promise.vim index 91388278e..10fee2acd 100644 --- a/autoload/vital/__vital__/Async/Promise.vim +++ b/autoload/vital/__vital__/Async/Promise.vim @@ -8,9 +8,6 @@ let s:PENDING = 0 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) function! s:noop(resolve, reject) abort @@ -37,7 +34,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 = type(a:callback) != v:t_none let success = 1 let Err = v:null if has_callback @@ -79,7 +76,7 @@ function! s:_publish(promise, ...) abort throw 'vital: Async.Promise: Cannot publish a pending promise' endif let child = a:promise._children[i] - if type(child) != s:NULL_T + if type(child) != v:t_none call s:_invoke_callback(settled, child, l:CB, a:promise._result) else call l:CB(a:promise._result) @@ -223,7 +220,7 @@ function! s:is_available() abort endfunction function! s:is_promise(maybe_promise) abort - return type(a:maybe_promise) == s:DICT_T && has_key(a:maybe_promise, '_vital_promise') + return type(a:maybe_promise) == v:t_dict && has_key(a:maybe_promise, '_vital_promise') endfunction function! s:_promise_then(...) dict abort