Formatting and comment wrapping

This commit is contained in:
Lucien Greathouse 2018-09-14 13:47:10 -07:00
parent d8c3bb9264
commit 639f0e8419
2 changed files with 10 additions and 8 deletions

View file

@ -19,7 +19,7 @@ end
wpcallPacked is a version of xpcall that: wpcallPacked is a version of xpcall that:
* Returns the length of the result first * Returns the length of the result first
* Returns the result packed into a table * Returns the result packed into a table
* Passes extra arguments through to the passed function, which xpcall does not * Passes extra arguments through to the passed function; xpcall doesn't
* Issues a warning if PROMISE_DEBUG is enabled * Issues a warning if PROMISE_DEBUG is enabled
]] ]]
local function wpcallPacked(f, ...) local function wpcallPacked(f, ...)
@ -188,8 +188,8 @@ function Promise.all(promises)
return Promise.resolve({}) return Promise.resolve({})
end end
-- We need to check that each value is a promise here so that we can produce a -- We need to check that each value is a promise here so that we can produce
-- proper error rather than a rejected promise with our error. -- a proper error rather than a rejected promise with our error.
for i = 1, #promises do for i = 1, #promises do
if not Promise.is(promises[i]) then if not Promise.is(promises[i]) then
error(("Non-promise value passed into Promise.all at index #%d"):format(i), 2) error(("Non-promise value passed into Promise.all at index #%d"):format(i), 2)
@ -199,8 +199,9 @@ function Promise.all(promises)
return Promise.new(function(resolve, reject) return Promise.new(function(resolve, reject)
-- An array to contain our resolved values from the given promises. -- An array to contain our resolved values from the given promises.
local resolvedValues = {} local resolvedValues = {}
-- Keep a count of resolved promises because just checking the resolved values length
-- wouldn't account for promises that resolve with nil. -- Keep a count of resolved promises because just checking the resolved
-- values length wouldn't account for promises that resolve with nil.
local resolvedCount = 0 local resolvedCount = 0
local rejected = false local rejected = false
@ -219,7 +220,8 @@ function Promise.all(promises)
end end
end end
-- We can assume the values inside `promises` are all promises since we checked above. -- We can assume the values inside `promises` are all promises since we
-- checked above.
for i = 1, #promises do for i = 1, #promises do
promises[i]:andThen( promises[i]:andThen(
function(...) function(...)