summaryrefslogtreecommitdiff
path: root/server-beta/src/core/getfield.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-10-19 14:42:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-10-19 14:42:25 +0800
commit5370e58f0c54f840f423e7b666df301499eca4e7 (patch)
treefae1c81316f52173eeb63d1d5bc935b3115b15e6 /server-beta/src/core/getfield.lua
parent3a62f5fd81e5857e558057a2871e068320d796f0 (diff)
downloadlua-language-server-5370e58f0c54f840f423e7b666df301499eca4e7.zip
整理代码
Diffstat (limited to 'server-beta/src/core/getfield.lua')
-rw-r--r--server-beta/src/core/getfield.lua20
1 files changed, 15 insertions, 5 deletions
diff --git a/server-beta/src/core/getfield.lua b/server-beta/src/core/getfield.lua
index aa07719b..badd41cf 100644
--- a/server-beta/src/core/getfield.lua
+++ b/server-beta/src/core/getfield.lua
@@ -5,11 +5,21 @@ local m = {}
function m:ref(source, callback)
local key = guide.getKeyName(source)
- self:eachField(source.node, key, function (src, mode)
- if mode == 'set' or mode == 'get' then
- callback(src, mode)
- end
- end)
+ local node = source.node
+ if node.type == 'setfield'
+ or node.type == 'getfield'
+ or node.type == 'setmethod'
+ or node.type == 'getmethod'
+ or node.type == 'setindex'
+ or node.type == 'getindex' then
+ self:eachField(node.node, key, function (src, mode)
+ if mode == 'set' or mode == 'get' then
+ callback(src, mode)
+ end
+ end)
+ else
+ self:eachRef(node, callback)
+ end
end
function m:field(source, key, callback)