From 2d242061f9ff6e9be0d6800fc9f542b3078844df 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 17:47:16 +0800 Subject: =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/service.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/src/service.lua b/server/src/service.lua index 2d31ad9e..16c1f549 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -311,8 +311,15 @@ function mt:reCompile() self.emmy:remove() end + local compiled = {} + local needCompile = {} + for uri in self._files:eachFile() do + needCompile[uri] = true + end + self._files:clear() + for _, obj in pairs(listMgr.list) do if obj.type == 'source' or obj.type == 'function' then obj:kill() @@ -325,9 +332,12 @@ function mt:reCompile() self.globalValue = nil self._compileTask:remove() self._needCompile = {} - local compiled = {} for uri, buf in self._files:eachOpened() do self:readText(uri, uric.decode(uri), buf, compiled) + self:needCompile(uri, compiled) + end + for uri in pairs(needCompile) do + self:needCompile(uri, compiled) end self:_testMemory('skip') -- cgit v1.2.3