summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script-beta/parser/guide.lua31
-rw-r--r--script-beta/vm/guideInterface.lua31
2 files changed, 30 insertions, 32 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index 88c81414..2a930c79 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -1217,16 +1217,27 @@ function m.checkSameSimpleInCall(status, ref, start, queue, mode)
if not func then
return
end
- local objs = status.interface.call(func, args, index, mode)
- if objs then
- for _, obj in ipairs(objs) do
- queue[#queue+1] = {
- obj = obj,
- start = start,
- force = true,
- call = true,
- }
- end
+ local objs = status.interface.call(func, args, index)
+ if not objs then
+ return
+ end
+ local newStatus = m.status(status)
+ for _, obj in ipairs(objs) do
+ m.searchRefs(newStatus, obj, 'ref')
+ queue[#queue+1] = {
+ obj = obj,
+ start = start,
+ force = true,
+ call = true,
+ }
+ end
+ for _, obj in ipairs(newStatus.results) do
+ queue[#queue+1] = {
+ obj = obj,
+ start = start,
+ force = true,
+ call = true,
+ }
end
end
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