summaryrefslogtreecommitdiff
path: root/server-beta/src/core/engineer.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-10-10 11:41:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-10-10 11:41:58 +0800
commit51216d347b59e33fcad96400ddae262971ede712 (patch)
tree7274d335ca0ad09d9b5883db316b2a4b7ad20b64 /server-beta/src/core/engineer.lua
parentd65825e90bc7137f50cafc36ba0972db5e6a55be (diff)
downloadlua-language-server-51216d347b59e33fcad96400ddae262971ede712.zip
更新
Diffstat (limited to 'server-beta/src/core/engineer.lua')
-rw-r--r--server-beta/src/core/engineer.lua60
1 files changed, 22 insertions, 38 deletions
diff --git a/server-beta/src/core/engineer.lua b/server-beta/src/core/engineer.lua
index 76a360cc..efc88828 100644
--- a/server-beta/src/core/engineer.lua
+++ b/server-beta/src/core/engineer.lua
@@ -53,7 +53,7 @@ mt['table'] = require 'core.table'
-- end
--end
-function mt:asindex(source, mode, callback)
+function mt:asIndex(source, mode, callback)
local parent = source.parent
if not parent then
return
@@ -75,55 +75,39 @@ function mt:getSpecial(source)
return name
end
-function mt:search(source, method, mode, callback)
- local f = mt[method]
+function mt:eachField(source, key, callback)
+ local tp = source.type
+ local d = mt[tp]
+ if not d then
+ return
+ end
+ local f = d.field
if not f then
return
end
- f(self, source, mode, callback)
+ f(self, source, key, callback)
end
-function mt:eachField(node, key, mode, callback)
- self:eachRef(node, 'field', function (src)
- if not key or key == guide.getKeyName(src) then
- if mode == 'def' then
- if src.type == 'setfield'
- or src.type == 'tablefield' then
- callback(src.field, 'set')
- elseif src.type == 'setindex'
- or src.type == 'tableindex' then
- callback(src.index, 'set')
- elseif src.type == 'setmethod' then
- callback(src.method, 'set')
- end
- elseif mode == 'ref' then
- if src.type == 'setfield'
- or src.type == 'tablefield' then
- callback(src.field, 'set')
- elseif src.type == 'setindex'
- or src.type == 'tableindex' then
- callback(src.index, 'set')
- elseif src.type == 'setmethod' then
- callback(src.method, 'set')
- elseif src.type == 'getfield' then
- callback(src.field, 'get')
- elseif src.type == 'getindex' then
- callback(src.index, 'get')
- elseif src.type == 'getmethod' then
- callback(src.method, 'get')
- end
- end
- end
- end)
+function mt:eachRef(source, callback)
+ local tp = source.type
+ local d = mt[tp]
+ if not d then
+ return
+ end
+ local f = d.ref
+ if not f then
+ return
+ end
+ f(self, source, callback)
end
-function mt:eachRef(source, mode, callback)
+function mt:eachDef(source, callback)
local tp = source.type
local d = mt[tp]
if not d then
return
end
- local f = d[mode]
+ local f = d.def
if not f then
return
end