|
55 | 55 | --- @tparam any ... Arguments for func
|
56 | 56 | --- @treturn async_t Handle
|
57 | 57 | function M.run(func, callback, ...)
|
58 |
| - vim.validate({ |
59 |
| - func = { func, "function" }, |
60 |
| - callback = { callback, "function", true }, |
61 |
| - }) |
62 | 58 | local co = coroutine.create(func)
|
63 | 59 | local handle = Async_T.new(co)
|
64 | 60 | local function step(...)
|
@@ -89,10 +85,6 @@ function M.run(func, callback, ...)
|
89 | 85 | return handle
|
90 | 86 | end
|
91 | 87 | local function wait(argc, func, ...)
|
92 |
| - vim.validate({ |
93 |
| - argc = { argc, "number" }, |
94 |
| - func = { func, "function" }, |
95 |
| - }) |
96 | 88 | -- Always run the wrapped functions in xpcall and re-raise the error in the
|
97 | 89 | -- coroutine. This makes pcall work as normal.
|
98 | 90 | local function pfunc(...)
|
|
133 | 125 | --- @tparam boolean strict Error when called in non-async context
|
134 | 126 | --- @treturn function(...):async_t
|
135 | 127 | function M.create(func, argc, strict)
|
136 |
| - vim.validate({ |
137 |
| - func = { func, "function" }, |
138 |
| - argc = { argc, "number", true }, |
139 |
| - }) |
140 | 128 | argc = argc or 0
|
141 | 129 | return function(...)
|
142 | 130 | if M.running() then
|
|
154 | 142 | --- @tparam function func
|
155 | 143 | --- @tparam boolean strict Error when called in non-async context
|
156 | 144 | function M.void(func, strict)
|
157 |
| - vim.validate({ func = { func, "function" } }) |
158 | 145 | return function(...)
|
159 | 146 | if M.running() then
|
160 | 147 | if strict then
|
|
172 | 159 | --- @tparam boolean strict Error when called in non-async context
|
173 | 160 | --- @treturn function Returns an async function
|
174 | 161 | function M.wrap(func, argc, strict)
|
175 |
| - vim.validate({ |
176 |
| - argc = { argc, "number" }, |
177 |
| - }) |
178 | 162 | return function(...)
|
179 | 163 | if not M.running() then
|
180 | 164 | if strict then
|
|
0 commit comments