This commit is contained in:
Bruce Hill 2017-10-13 18:09:46 -07:00
parent e476bfea52
commit a176c7dfb5

View File

@ -443,7 +443,7 @@ do
return ("\n%-3d|"):format(n) return ("\n%-3d|"):format(n)
end end
local code = "1 |" .. code_for_statement:gsub("\n", fn) local code = "1 |" .. code_for_statement:gsub("\n", fn)
error("Failed to compile generated code:\n" .. tostring(colored.bright(colored.blue(code))) .. "\n\n" .. tostring(err) .. "\n\nProduced by statement:\n" .. tostring(colored.bright(colored.yellow(statement.src)))) error("Failed to compile generated code:\n" .. tostring(colored.bright(colored.blue(colored.onblack(code)))) .. "\n\n" .. tostring(err) .. "\n\nProduced by statement:\n" .. tostring(colored.bright(colored.yellow(statement.src))))
end end
local run_statement = lua_thunk() local run_statement = lua_thunk()
local ret local ret
@ -456,7 +456,7 @@ do
self:errorln(debug.traceback()) self:errorln(debug.traceback())
self:error(ret) self:error(ret)
end end
insert(buffer, tostring(statements or '') .. "\n" .. tostring(expr and "ret = " .. tostring(expr) or '')) insert(buffer, tostring(statements or '') .. "\n" .. tostring(expr and "ret = " .. tostring(expr) .. ";" or ''))
end end
if max_operations then if max_operations then
debug.sethook() debug.sethook()
@ -475,7 +475,7 @@ do
end end
local lua_thunk, err = load(code) local lua_thunk, err = load(code)
if not lua_thunk then if not lua_thunk then
self:error("Failed to compile generated code:\n" .. tostring(colored.bright(colored.blue(code))) .. "\n\n" .. tostring(colored.red(err))) self:error("Failed to compile generated code:\n" .. tostring(colored.bright(colored.blue(colored.onblack(code)))) .. "\n\n" .. tostring(colored.red(err)))
end end
return (lua_thunk())(self, vars or { }) return (lua_thunk())(self, vars or { })
end, end,