local SO = require "dmlib.sourceoptimizer" local function read(input) local fh if input == '-' then fh = io.stdin else fh = assert(io.open(input)) end local text = fh:read'*a' return text end table.remove(arg,1) --bug in metalua? --FIX if #arg ~= 1 then io.stderr:write('lua refactor.lua ') os.exit(1) end local input = arg[1] local code = read(input) local code2 = SO.inline_functions_code(code) print(code2)