summaryrefslogtreecommitdiff
path: root/server-beta/src/core/getfield.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-10-14 20:31:55 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-10-14 20:31:55 +0800
commitb735bbc94ce68bd1a7b66f2f2b195e4951508d42 (patch)
treeed408652a912cc98768ffa8fadc6798e8e718272 /server-beta/src/core/getfield.lua
parent94e9133d7b25050212bbda323ef83f30142352e8 (diff)
downloadlua-language-server-b735bbc94ce68bd1a7b66f2f2b195e4951508d42.zip
整理代码
Diffstat (limited to 'server-beta/src/core/getfield.lua')
-rw-r--r--server-beta/src/core/getfield.lua43
1 files changed, 30 insertions, 13 deletions
diff --git a/server-beta/src/core/getfield.lua b/server-beta/src/core/getfield.lua
index af16bdf5..328de34a 100644
--- a/server-beta/src/core/getfield.lua
+++ b/server-beta/src/core/getfield.lua
@@ -5,27 +5,44 @@ local m = {}
function m:field(source, key, callback)
local used = {}
- used[source] = true
local found = false
+ used[source] = true
+
local node = source.node
+ used[node] = true
+
+ callback(source.field, 'get')
local myKey = guide.getKeyName(source)
+ self:eachField(node, myKey, function (src, mode)
+ if used[src] then
+ return
+ end
+ used[src] = true
+ self:eachField(src, key, function (src, mode)
+ used[src] = true
+ if mode == 'set' then
+ callback(src, mode)
+ found = true
+ end
+ end)
+ end)
+
self:eachValue(node, function (src)
self:eachField(src, myKey, function (src, mode)
- if mode == 'set' then
- self:eachValue(src, function (src)
- self:eachField(src, key, function (src, mode)
- if key == guide.getKeyName(src) then
- used[src] = true
- callback(src, mode)
- if mode == 'set' then
- found = true
- end
- end
- end)
- end)
+ if used[src] then
+ return
end
+ used[src] = true
+ self:eachField(src, key, function (src, mode)
+ used[src] = true
+ if mode == 'set' then
+ callback(src, mode)
+ found = true
+ end
+ end)
end)
end)
+
checkSMT(self, key, used, found, callback)
end