Skip to content

Commit 8f6b866

Browse files
committed
Async.Promise: Prefer v:t_*
1 parent 522f48e commit 8f6b866

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

autoload/vital/__vital__/Async/Promise.vim

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ let s:PENDING = 0
88
let s:FULFILLED = 1
99
let s:REJECTED = 2
1010

11-
let s:DICT_T = type({})
12-
let s:NULL_T = type(v:null)
13-
1411
" @vimlint(EVL103, 1, a:resolve)
1512
" @vimlint(EVL103, 1, a:reject)
1613
function! s:noop(resolve, reject) abort
@@ -37,7 +34,7 @@ endfunction
3734

3835
" ... is added to use this function as a callback of timer_start()
3936
function! s:_invoke_callback(settled, promise, callback, result, ...) abort
40-
let has_callback = type(a:callback) != s:NULL_T
37+
let has_callback = type(a:callback) != v:t_none
4138
let success = 1
4239
let Err = v:null
4340
if has_callback
@@ -79,7 +76,7 @@ function! s:_publish(promise, ...) abort
7976
throw 'vital: Async.Promise: Cannot publish a pending promise'
8077
endif
8178
let child = a:promise._children[i]
82-
if type(child) != s:NULL_T
79+
if type(child) != v:t_none
8380
call s:_invoke_callback(settled, child, l:CB, a:promise._result)
8481
else
8582
call l:CB(a:promise._result)
@@ -223,7 +220,7 @@ function! s:is_available() abort
223220
endfunction
224221

225222
function! s:is_promise(maybe_promise) abort
226-
return type(a:maybe_promise) == s:DICT_T && has_key(a:maybe_promise, '_vital_promise')
223+
return type(a:maybe_promise) == v:t_dict && has_key(a:maybe_promise, '_vital_promise')
227224
endfunction
228225

229226
function! s:_promise_then(...) dict abort

0 commit comments

Comments
 (0)