diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-11-30 18:42:20 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-11-30 18:42:20 +0800 |
commit | 7ee73ee0efbb27c14ab9a0ca050e282758ba6538 (patch) | |
tree | 874945d29911edc5962998dfc175cc136737c73d /server | |
parent | 0c6436f78d48c6b4d6494ad9c3d573b6aa7baf06 (diff) | |
download | lua-language-server-7ee73ee0efbb27c14ab9a0ca050e282758ba6538.zip |
穿透setmetatable的第一个参数
Diffstat (limited to 'server')
-rw-r--r-- | server/src/matcher/definition.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/server/src/matcher/definition.lua b/server/src/matcher/definition.lua index a00337d1..9b850f94 100644 --- a/server/src/matcher/definition.lua +++ b/server/src/matcher/definition.lua @@ -118,7 +118,7 @@ function mt:searchCall(call, simple, i) if metatable then local index = self:getField(metatable, '__index') if obj then - self:setTable(obj, index) + self:setTable(obj, index, 'copy') return obj else return index @@ -224,10 +224,20 @@ function mt:searchReturn(action) end end -function mt:setTable(var, tbl) +function mt:setTable(var, tbl, mode) if not var or not tbl then return end + if mode == 'copy' then + for k, v in pairs(var.childs) do + if tbl.childs[k] then + for i, info in ipairs(v) do + table.insert(tbl.childs[k], 1, info) + end + end + tbl.childs[k] = v + end + end var.childs = tbl.childs end |