summaryrefslogtreecommitdiff
path: root/script-beta
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta')
-rw-r--r--script-beta/core/reference.lua16
-rw-r--r--script-beta/parser/guide.lua19
2 files changed, 27 insertions, 8 deletions
diff --git a/script-beta/core/reference.lua b/script-beta/core/reference.lua
index e61e2940..bd4cd6b7 100644
--- a/script-beta/core/reference.lua
+++ b/script-beta/core/reference.lua
@@ -11,16 +11,24 @@ end
local function sortResults(results)
-- 先按照顺序排序
table.sort(results, function (a, b)
- return a.target.start < b.target.start
+ local u1 = guide.getRoot(a).uri
+ local u2 = guide.getRoot(b).uri
+ if u1 == u2 then
+ return a.target.start < b.target.start
+ else
+ return u1 < u2
+ end
end)
-- 如果2个结果处于嵌套状态,则取范围小的那个
- local lf
+ local lf, lu
for i = #results, 1, -1 do
local res = results[i].target
- local f = res.finish
- if lf and f > lf then
+ local f = res.finish
+ local uri = guide.getRoot(res).uri
+ if lf and f > lf and uri == lu then
table.remove(results, i)
else
+ lu = uri
lf = f
end
end
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua
index ac218170..1c3d0460 100644
--- a/script-beta/parser/guide.lua
+++ b/script-beta/parser/guide.lua
@@ -1215,9 +1215,18 @@ function m.checkSameSimpleInCallInSameFile(status, func, args, index)
local results = {}
for _, def in ipairs(newStatus.results) do
if def.type == 'function' then
-
+ local returns = def.returns
+ if returns then
+ for _, ret in ipairs(returns) do
+ local exp = ret[index]
+ if exp then
+ results[#results+1] = exp
+ end
+ end
+ end
end
end
+ return results
end
function m.checkSameSimpleInCall(status, ref, start, queue, mode)
@@ -1229,9 +1238,11 @@ function m.checkSameSimpleInCall(status, ref, start, queue, mode)
return
end
local objs = m.checkSameSimpleInCallInSameFile(status, func, args, index)
- local objs = status.interface.call(func, args, index)
- if not objs then
- return
+ local cobjs = status.interface.call(func, args, index)
+ if cobjs then
+ for _, obj in ipairs(cobjs) do
+ objs[#objs+1] = obj
+ end
end
local newStatus = m.status(status)
for _, obj in ipairs(objs) do