File tree Expand file tree Collapse file tree
extension/script/backend/worker Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,23 +43,9 @@ local function generate(name, init)
4343end
4444
4545generate (" dump" , function ()
46- if luaver .LUAVERSION <= 52 then
47- local compat_dump = assert (load (readfile ' backend.worker.eval.dump' ))
48- return function (content )
49- local ok , res , err = pcall (compat_dump , content )
50- if ok and res ~= nil then
51- return true , res
52- end
53- if ok then
54- return false , ' can not dump function.'
55- end
56- return false , res
57- end
58- else
59- local eval_dump = assert (rdebug .load (readfile ' backend.worker.eval.dump' ))
60- return function (content )
61- return rdebug .eval (eval_dump , content , 0 )
62- end
46+ local eval_dump = assert (rdebug .load (readfile ' backend.worker.eval.dump' ))
47+ return function (content )
48+ return rdebug .eval (eval_dump , content , 0 )
6349 end
6450end )
6551
Original file line number Diff line number Diff line change 9696return function (content , syntaxCompatibility )
9797 local err
9898 local bin
99+ local cl , v
99100 if syntaxCompatibility then
100101 bin , err = dumpTarget (content )
102+ if not bin then
103+ local log = require ' common.log'
104+ log .error (" ERROR:" .. (err or " unknown error" ))
105+ return
106+ end
107+ local ok
108+ ok , cl , v = pcall (undump , bin )
109+ if not ok then
110+ local log = require ' common.log'
111+ log .error (" ERROR:" .. tostring (cl ))
112+ return
113+ end
101114 else
102115 local f
103116 f , err = load (content )
104- if f then
105- bin = string.dump (f )
117+ if not f then
118+ local log = require ' common.log'
119+ log .error (" ERROR:" .. (err or " unknown error" ))
120+ return
106121 end
107- end
108- if not bin then
109- local log = require ' common.log'
110- log .error (" ERROR:" .. (err or " unknown error" ))
111- return
112- end
113- local ok , cl , v = pcall (undump , bin )
114- if not ok then
115- local log = require ' common.log'
116- log .error (" ERROR:" .. tostring (cl ))
117- return
122+ bin = string.dump (f )
123+ cl , v = undump (bin )
118124 end
119125 version = v
120126 local si = { activelines = {}, definelines = {} }
You can’t perform that action at this time.
0 commit comments