summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-08 15:49:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-08 15:49:16 +0800
commit94069457d8a91dc6b53850d2a4a52eaf160de955 (patch)
treeea95b222a56666265c2c521211148b8baf49bcd9
parenta16676ea0ec939c6848f88247e336223d20a2378 (diff)
downloadlua-language-server-94069457d8a91dc6b53850d2a4a52eaf160de955.zip
一些优化
-rw-r--r--server/src/vm/value.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua
index d47d6c15..b520054c 100644
--- a/server/src/vm/value.lua
+++ b/server/src/vm/value.lua
@@ -170,6 +170,7 @@ function mt:eachChild(callback, mark, foundIndex)
return method:eachChild(callback, mark, foundIndex)
end
+local hasSource = {}
function mt:mergeValue(value)
if value._type then
for tp, rate in pairs(value._type) do
@@ -184,7 +185,6 @@ function mt:mergeValue(value)
self._child[k] = v
end
end
- local hasSource = {}
for _, info in ipairs(self) do
hasSource[info.source] = true
end
@@ -193,6 +193,9 @@ function mt:mergeValue(value)
self[#self+1] = info
end
end
+ for k in pairs(hasSource) do
+ hasSource[k] = nil
+ end
if value._meta then
self._meta = value._meta
end