summaryrefslogtreecommitdiff
path: root/server-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-10-31 19:24:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-10-31 19:24:43 +0800
commitb63286f959f6a07c8901b0e3f0e03e81a935ac4d (patch)
tree83befaeb6f20013135d0f9a1a06c1f61678686d4 /server-beta
parent624c1ddbffafef38b797f181fbcca000b293b60b (diff)
downloadlua-language-server-b63286f959f6a07c8901b0e3f0e03e81a935ac4d.zip
暂存
Diffstat (limited to 'server-beta')
-rw-r--r--server-beta/src/searcher/eachRef.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/server-beta/src/searcher/eachRef.lua b/server-beta/src/searcher/eachRef.lua
index b490f0a2..2d9d64b6 100644
--- a/server-beta/src/searcher/eachRef.lua
+++ b/server-beta/src/searcher/eachRef.lua
@@ -69,6 +69,35 @@ local function ofSelf(searcher, loc, callback)
-- 2. 调用该方法时传入的对象
end
+--- 自己作为赋值的值
+local function asValue(searcher, source, callback)
+ local parent = source.parent
+ if parent and parent.value == source then
+ if guide.getKeyName(parent) == 's|__index' then
+ if parent.type == 'tablefield'
+ or parent.type == 'tableindex' then
+ local t = parent.parent
+ local args = t.parent
+ if args[2] == t then
+ local call = args.parent
+ local func = call.node
+ if searcher:getSpecialName(func) == 'setmetatable' then
+ searcher:eachRef(args[1], callback)
+ end
+ end
+ end
+ end
+ end
+end
+
+--- 自己作为函数的参数
+local function asArg(searcher, source, callback)
+ local parent = source.parent
+ if parent == 'callargs' then
+ print(parent)
+ end
+end
+
local function ofLocal(searcher, loc, callback)
-- 方法中的 self 使用了一个虚拟的定义位置
if loc.tag ~= 'self' then
@@ -86,6 +115,7 @@ local function ofLocal(searcher, loc, callback)
source = ref,
mode = 'get',
}
+ asValue(searcher, ref, callback)
elseif ref.type == 'setlocal' then
callback {
searcher = searcher,
@@ -224,4 +254,5 @@ return function (searcher, source, callback)
source = source,
}
end
+ asArg(searcher, source, callback)
end