summaryrefslogtreecommitdiff
path: root/server-beta/src/core/engineer.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-10-10 19:34:12 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-10-10 19:34:12 +0800
commit8535713d22d4bfc1d02dea1b6fdc31324c61b760 (patch)
tree30b6cb52d464bd9acd43a365944f0a61f9f3ee47 /server-beta/src/core/engineer.lua
parentf8ae93feb7be0faba81ce72795b74bc4ec4dfe03 (diff)
downloadlua-language-server-8535713d22d4bfc1d02dea1b6fdc31324c61b760.zip
防止重复触发
Diffstat (limited to 'server-beta/src/core/engineer.lua')
-rw-r--r--server-beta/src/core/engineer.lua40
1 files changed, 32 insertions, 8 deletions
diff --git a/server-beta/src/core/engineer.lua b/server-beta/src/core/engineer.lua
index bfb9c98b..0d55479c 100644
--- a/server-beta/src/core/engineer.lua
+++ b/server-beta/src/core/engineer.lua
@@ -74,7 +74,14 @@ function mt:eachField(source, key, callback)
if not f then
return
end
- f(self, source, key, callback)
+ local mark = {}
+ f(self, source, key, function (src, ...)
+ if mark[src] then
+ return
+ end
+ mark[src] = true
+ callback(src, ...)
+ end)
end
function mt:eachRef(source, callback)
@@ -87,7 +94,14 @@ function mt:eachRef(source, callback)
if not f then
return
end
- f(self, source, callback)
+ local mark = {}
+ f(self, source, function (src, ...)
+ if mark[src] then
+ return
+ end
+ mark[src] = true
+ callback(src, ...)
+ end)
end
function mt:eachDef(source, callback)
@@ -100,7 +114,14 @@ function mt:eachDef(source, callback)
if not f then
return
end
- f(self, source, callback)
+ local mark = {}
+ f(self, source, function (src, ...)
+ if mark[src] then
+ return
+ end
+ mark[src] = true
+ callback(src, ...)
+ end)
end
function mt:eachValue(source, callback)
@@ -113,7 +134,14 @@ function mt:eachValue(source, callback)
if not f then
return
end
- f(self, source, callback)
+ local mark = {}
+ f(self, source, function (src, ...)
+ if mark[src] then
+ return
+ end
+ mark[src] = true
+ callback(src, ...)
+ end)
end
function mt:childDef(source, callback)
@@ -155,10 +183,6 @@ function mt:callArgOf(source)
return tableUnpack(args)
end
-function mt:callReturnOf(source)
-
-end
-
return function (ast)
local self = setmetatable({
step = 0,