diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-10-17 15:15:24 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-10-17 15:15:24 +0800 |
commit | cd139ff2f2eaefab4de54ab5c39c04aa992f7b51 (patch) | |
tree | 09cad9a28dfb20bed3f13b28f21a0552496fe0fa /server-beta/src/core | |
parent | 427ca6b4c555aa92e3d5bf82051c52d490dffd48 (diff) | |
download | lua-language-server-cd139ff2f2eaefab4de54ab5c39c04aa992f7b51.zip |
支持实例查找方法的引用
Diffstat (limited to 'server-beta/src/core')
-rw-r--r-- | server-beta/src/core/getfield.lua | 4 | ||||
-rw-r--r-- | server-beta/src/core/local.lua | 8 | ||||
-rw-r--r-- | server-beta/src/core/setmetatable.lua | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/server-beta/src/core/getfield.lua b/server-beta/src/core/getfield.lua index c76df24e..77a132ca 100644 --- a/server-beta/src/core/getfield.lua +++ b/server-beta/src/core/getfield.lua @@ -9,7 +9,9 @@ function m:field(source, key, callback) used[source] = true local node = source.node - used[node] = true + self:eachDef(node, function (src) + used[src] = true + end) local myKey = guide.getKeyName(source) if key == myKey then diff --git a/server-beta/src/core/local.lua b/server-beta/src/core/local.lua index 44e14596..eb0c8900 100644 --- a/server-beta/src/core/local.lua +++ b/server-beta/src/core/local.lua @@ -107,6 +107,14 @@ function m:value(source, callback) local ref = refs[i] if ref.type == 'setlocal' then self:eachValue(ref.value, callback) + elseif ref.type == 'getlocal' then + local parent = ref.parent + if parent.type == 'setmethod' then + local func = parent.value + if func and func.locals then + callback(func.locals[1]) + end + end end end end diff --git a/server-beta/src/core/setmetatable.lua b/server-beta/src/core/setmetatable.lua index ecb1a98d..978d165c 100644 --- a/server-beta/src/core/setmetatable.lua +++ b/server-beta/src/core/setmetatable.lua @@ -27,7 +27,7 @@ return function (self, key, used, found, callback) end) end -- mt.__index.field -> t.field - self:eachDef(src, function (src) + self:eachValue(src, function (src) if used[src] then self:eachValue(t, function (mtvalue) self:eachField(mtvalue, key, callback) |