summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/noder.lua1
-rw-r--r--script/core/searcher.lua37
-rw-r--r--script/log.lua2
3 files changed, 31 insertions, 9 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 277f4b94..4eb392e9 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -427,6 +427,7 @@ function m.compileNode(noders, source)
-- 参数/call禁止反向查找赋值
local valueType = valueID:match '^.-:'
if valueType ~= 'p:'
+ and valueType ~= 's:'
and valueType ~= 'c:' then
pushBackward(noders, valueID, id, 'set')
end
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index e7755598..73e9ca0f 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -430,11 +430,27 @@ function m.searchRefsByID(status, uri, expect, mode)
if not uris then
return
end
+ local isCall = id:sub(#firstID + 2, #firstID + 2) == noder.RETURN_INDEX
local tid = id .. (field or '')
- for guri in pairs(uris) do
- if not files.eq(uri, guri) then
+ for guri, def in pairs(uris) do
+ if def then
crossSearch(status, guri, tid, mode)
+ goto CONTINUE
+ end
+ if isCall then
+ goto CONTINUE
+ end
+ if not field then
+ goto CONTINUE
+ end
+ if mode == 'def' then
+ goto CONTINUE
end
+ if not files.eq(uri, guri) then
+ goto CONTINUE
+ end
+ crossSearch(status, guri, tid, mode)
+ ::CONTINUE::
end
end
@@ -486,6 +502,12 @@ function m.searchRefsByID(status, uri, expect, mode)
m.pushResult(status, mode, source, force)
end
end
+
+ if node.require then
+ checkRequire(node.require, field)
+ return true
+ end
+
if node.forward then
checkForward(id, node, field)
end
@@ -498,11 +520,7 @@ function m.searchRefsByID(status, uri, expect, mode)
checkENV(node.sources[1], field)
end
- if node.require then
- checkRequire(node.require, field)
- end
-
- checkMainReturn(id, node, field)
+ --checkMainReturn(id, node, field)
if node.call then
callStack[#callStack] = nil
@@ -522,7 +540,10 @@ function m.searchRefsByID(status, uri, expect, mode)
end
local node = noder.getNodeByID(root, id)
if node then
- searchNode(id, node, field)
+ local skip = searchNode(id, node, field)
+ if skip then
+ return
+ end
end
checkGlobal(id, node, field)
checkClass(id, node, field)
diff --git a/script/log.lua b/script/log.lua
index c3bf02d4..d27da1f0 100644
--- a/script/log.lua
+++ b/script/log.lua
@@ -1,7 +1,7 @@
local fs = require 'bee.filesystem'
local time = require 'bee.time'
-local monotonic = time.monotonic
+local monotonic = os.clock
local osDate = os.date
local ioOpen = io.open
local tablePack = table.pack