diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-12-10 21:26:35 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-12-10 21:26:35 +0800 |
commit | 1d8d37ce97e3ea7097dd23a4ac90198c92ed611b (patch) | |
tree | 6afff2d5efbf0085ef396f737b809df89ca7373f /script-beta/vm | |
parent | 85b30822bbf0f754e9a6054f3e8ee0e4b1a9387d (diff) | |
download | lua-language-server-1d8d37ce97e3ea7097dd23a4ac90198c92ed611b.zip |
支持调用片段
Diffstat (limited to 'script-beta/vm')
-rw-r--r-- | script-beta/vm/eachDef.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/script-beta/vm/eachDef.lua b/script-beta/vm/eachDef.lua index 1b7ea621..54460942 100644 --- a/script-beta/vm/eachDef.lua +++ b/script-beta/vm/eachDef.lua @@ -36,12 +36,13 @@ function vm.eachDef(source, callback) end end) + local res for _, info in ipairs(results) do local src = info.source local destUri = guide.getRoot(src).uri -- 如果是library,则直接放行 if src.library then - callback(info) + res = callback(info) goto CONTINUE end -- 如果是global或field,则直接放行(因为无法确定顺序) @@ -51,21 +52,24 @@ function vm.eachDef(source, callback) or src.type == 'tablefield' or src.type == 'tableindex' or src.type == 'setglobal' then - callback(info) + res = callback(info) goto CONTINUE end -- 如果是同一个文件,则检查位置关系后放行 if sourceUri == destUri then if checkPath(source, info) then - callback(info) + res = callback(info) end goto CONTINUE end -- 如果不是同一个文件,则必须在该文件 return 后才放行 if valueUris[destUri] then - callback(info) + res = callback(info) goto CONTINUE end ::CONTINUE:: + if res ~= nil then + return res + end end end |