From 14dea676e24e3d2ef5ddba0ede98c348d2701c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 12 Aug 2020 17:53:35 +0800 Subject: =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/vm/guideInterface.lua | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'script-beta/vm') 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 -- cgit v1.2.3