summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-19 15:24:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-19 15:24:43 +0800
commit1fe0691e0614875e90e6078e20e332818b6dcabd (patch)
treeb990c5745602340d1016c0bbf65b8b8f979b1bc7 /server
parent9044f63d2e244cf01301aa6af2e62faea0e91e59 (diff)
downloadlua-language-server-1fe0691e0614875e90e6078e20e332818b6dcabd.zip
优化
Diffstat (limited to 'server')
-rw-r--r--server/src/vm/value.lua26
1 files changed, 19 insertions, 7 deletions
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua
index c9d8cb4b..06a7ba30 100644
--- a/server/src/vm/value.lua
+++ b/server/src/vm/value.lua
@@ -266,15 +266,27 @@ function mt:mergeValue(value)
--end
--value._child = self._child
- for srcId, info in pairs(value._info) do
- local src = sourceMgr.list[srcId]
- if src then
- self._infoCount = self._infoCount + 1
- self._info[srcId] = info
+ if self._infoCount > value._infoCount then
+ for srcId, info in pairs(value._info) do
+ local src = sourceMgr.list[srcId]
+ if src and not self._info[srcId] then
+ self._infoCount = self._infoCount + 1
+ self._info[srcId] = info
+ end
+ end
+ value._info = self._info
+ value._infoCount = self._infoCount
+ else
+ for srcId, info in pairs(self._info) do
+ local src = sourceMgr.list[srcId]
+ if src and not value._info[srcId] then
+ value._infoCount = value._infoCount + 1
+ value._info[srcId] = info
+ end
end
+ self._info = value._info
+ self._infoCount = value._infoCount
end
- value._info = self._info
- value._infoCount = self._infoCount
if value._meta then
self._meta = value._meta