From 859bf22a7d50473ae796f9a33a15de413cf0604c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 24 Jun 2019 11:42:54 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/files/files.lua | 14 ++------------ server/src/service.lua | 8 +++++--- server/src/task.lua | 1 - 3 files changed, 7 insertions(+), 16 deletions(-) (limited to 'server') diff --git a/server/src/files/files.lua b/server/src/files/files.lua index cf619381..4d420739 100644 --- a/server/src/files/files.lua +++ b/server/src/files/files.lua @@ -67,19 +67,9 @@ function mt:get(uri) return self._files[uri] end ----@param uri uri ----@param vm VM -function mt:saveVM(uri, vm) - local f = self._files[uri] - if not f then - return - end - f:saveVM(vm) -end - -function mt:clear() +function mt:clearVM() for _, f in pairs(self._files) do - f:remove() + f:removeVM() end end diff --git a/server/src/service.lua b/server/src/service.lua index 1d60f22d..8ba9cd3b 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -286,7 +286,7 @@ function mt:reCompile() reload[uri] = true end - self._files:clear() + self._files:clearVM() for _, obj in pairs(listMgr.list) do if obj.type == 'source' or obj.type == 'function' then @@ -299,6 +299,7 @@ function mt:reCompile() self.emmy = emmyMgr() self.globalValue = nil self._compileTask:remove() + --self._compileTask = nil self._needCompile = {} local compiled = {} local n = 0 @@ -323,7 +324,7 @@ function mt:clearAllFiles() for uri in self._files:eachFile() do self:clearDiagnostics(uri) end - self._files:clear() + self._files:clearVM() end ---@param uri uri @@ -483,7 +484,7 @@ function mt:compileVM(uri) end return nil end - file:saveVM(vm, os.clock() - clock, version) + file:saveVM(vm, version, os.clock() - clock) local clock = os.clock() local lines = parser:lines(file:getText(), 'utf8') @@ -899,6 +900,7 @@ function mt:_testFindDeadValues() pop() end scan('root', self._files) + log.debug('Finish...') end function mt:onTick() diff --git a/server/src/task.lua b/server/src/task.lua index a1ed37de..88db7a28 100644 --- a/server/src/task.lua +++ b/server/src/task.lua @@ -56,7 +56,6 @@ end return function (callback) local self = setmetatable({ - callback = callback, data = {}, task = coroutine.create(callback), }, mt) -- cgit v1.2.3