Comparison

util/promise.lua @ 9558:5fa73fbb047f

util.promise: Remove the non-standard ability to pass a promise to reject()
author Matthew Wild <mwild1@gmail.com>
date Fri, 26 Oct 2018 09:23:31 +0100
parent 9550:98de4c2e2627
child 9559:7c65e3f38e6e
comparison
equal deleted inserted replaced
9557:d7fdd418adf8 9558:5fa73fbb047f
63 63
64 end 64 end
65 local function _reject(e) 65 local function _reject(e)
66 if resolved then return; end 66 if resolved then return; end
67 resolved = true; 67 resolved = true;
68 if is_promise(e) then 68 if promise_settle(p, "rejected", next_rejected, p._pending_on_rejected, e) then
69 e:next(new_resolve_functions(p));
70 elseif promise_settle(p, "rejected", next_rejected, p._pending_on_rejected, e) then
71 p.reason = e; 69 p.reason = e;
72 end 70 end
73 end 71 end
74 return _resolve, _reject; 72 return _resolve, _reject;
75 end 73 end