Skip to content

Commit

Permalink
简化undump
Browse files Browse the repository at this point in the history
  • Loading branch information
actboy168 committed Sep 18, 2023
1 parent 7e25e2b commit 4520a02
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
18 changes: 0 additions & 18 deletions extension/script/backend/worker/eval.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,6 @@ local function generate(name, init)
end
end

generate("dump", function()
if luaver.LUAVERSION <= 52 then
local compat_dump = assert(load(readfile 'backend.worker.eval.dump'))
return function(content)
local res, err = compat_dump(content)
if res then
return true, res
end
return false, err
end
else
local eval_dump = assert(rdebug.load(readfile 'backend.worker.eval.dump'))
return function(content)
return rdebug.eval(eval_dump, content, 0)
end
end
end)

generate("ffi_reflect", function ()
if not luaver.isjit then
return
Expand Down
6 changes: 0 additions & 6 deletions extension/script/backend/worker/eval/dump.lua

This file was deleted.

6 changes: 3 additions & 3 deletions extension/script/backend/worker/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ local undump = require 'backend.worker.undump'
local version

local function getproto(content)
local eval = require 'backend.worker.eval'
local ok, bin = eval.dump(content)
if not ok or type(bin) ~= "string" then
local f = load(content)
if not f then
return
end
local bin = string.dump(f)
local cl, v = undump(bin)
version = v
return cl.f
Expand Down

0 comments on commit 4520a02

Please sign in to comment.