lua code lgtm

https://codereview.chromium.org/931233002/diff/60001/tools/gcmole/gcmole.lua
File tools/gcmole/gcmole.lua (right):

https://codereview.chromium.org/931233002/diff/60001/tools/gcmole/gcmole.lua#newcode117
tools/gcmole/gcmole.lua:117: function IterTable(t)
I'd write it

local function IterTable(t)
  return coroutine.wrap(function ()
    for i, v in ipairs(t) do
      coroutine.yield(v)
    end
  end)
end

or (which arguably is uglier)

local function IterTable(t)
  local f, n = ipairs(t), 0
  return function ()
    local v
    n, v = ipairs(t, n)
    return n
  end
end

but see the suggestion below which can eliminate the need for it
entirely.

https://codereview.chromium.org/931233002/diff/60001/tools/gcmole/gcmole.lua#newcode182
tools/gcmole/gcmole.lua:182: action = table.concat(parallel_cmd_line, "
")
arguably you can just do

action = table.concat(parallel_cmd_line, " ") .. " " ..
table.concat(filenames, " ")

and kill the loop above

https://codereview.chromium.org/931233002/diff/60001/tools/gcmole/gcmole.lua#newcode185
tools/gcmole/gcmole.lua:185: local success = SplitResults(pipe:lines(),
func) and pipe:close()
pipe will not be closed if SplitResults returns false.

https://codereview.chromium.org/931233002/diff/60001/tools/gcmole/gcmole.lua#newcode409
tools/gcmole/gcmole.lua:409: local function SearchForErrors(filename,
lines)
if you change signature of this function and `parse` to (filename,
iterator, lines) and do

for l in iterator(lines) do ... end

then you can write

func(..., ipairs, current) instead of IterTable.

and

func(..., pipe.lines, pipe) instead of func(..., pipe:lines())

https://codereview.chromium.org/931233002/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to