diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-12 17:53:35 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-12 17:53:35 +0800 |
commit | 14dea676e24e3d2ef5ddba0ede98c348d2701c83 (patch) | |
tree | e80c37887efe61adf6251f223233d8620cfb7242 /script-beta/vm | |
parent | 75c8974c57b509bf9342e1d03a594ede2380e46c (diff) | |
download | lua-language-server-14dea676e24e3d2ef5ddba0ede98c348d2701c83.zip |
暂存
Diffstat (limited to 'script-beta/vm')
-rw-r--r-- | script-beta/vm/guideInterface.lua | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/script-beta/vm/guideInterface.lua b/script-beta/vm/guideInterface.lua index d68e637f..01f5e0e0 100644 --- a/script-beta/vm/guideInterface.lua +++ b/script-beta/vm/guideInterface.lua @@ -5,7 +5,7 @@ local guide = require 'parser.guide' local m = {} -function m.searchFileReturn(results, ast, index, mode) +function m.searchFileReturn(results, ast, index) local returns = ast.returns if not returns then return @@ -13,25 +13,12 @@ function m.searchFileReturn(results, ast, index, mode) for _, ret in ipairs(returns) do local exp = ret[index] if exp then - if exp.type == 'table' then - vm.mergeResults(results, { exp }) - else - local newRes - if mode == 'ref' then - newRes = vm.getRefs(exp) - else - newRes = vm.getDefs(exp) - end - if #newRes > 0 then - vm.mergeResults(results, newRes) - end - vm.mergeResults(results, { exp }) - end + vm.mergeResults(results, { exp }) end end end -function m.require(args, index, mode) +function m.require(args, index) local reqName = args[1] and args[1][1] if not reqName then return nil @@ -43,14 +30,14 @@ function m.require(args, index, mode) if not files.eq(myUri, uri) then local ast = files.getAst(uri) if ast then - m.searchFileReturn(results, ast.ast, index, mode) + m.searchFileReturn(results, ast.ast, index) end end end return results end -function m.dofile(args, index, mode) +function m.dofile(args, index) local reqName = args[1] and args[1][1] if not reqName then return @@ -62,7 +49,7 @@ function m.dofile(args, index, mode) if not files.eq(myUri, uri) then local ast = files.getAst(uri) if ast then - m.searchFileReturn(results, ast.ast, index, mode) + m.searchFileReturn(results, ast.ast, index) end end end @@ -71,16 +58,16 @@ end vm.interface = {} -function vm.interface.call(func, args, index, mode) +function vm.interface.call(func, args, index) local lib = vm.getLibrary(func) if not lib then return nil end if lib.name == 'require' and index == 1 then - return m.require(args, index, mode) + return m.require(args, index) end if lib.name == 'dofile' then - return m.dofile(args, index, mode) + return m.dofile(args, index) end end |