summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/noder.lua5
-rw-r--r--script/core/searcher.lua18
-rw-r--r--test.lua2
-rw-r--r--test/definition/bug.lua8
4 files changed, 20 insertions, 13 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 7a1733de..8fd7603c 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -109,7 +109,7 @@ local function getKey(source)
elseif source.type == 'function' then
return source.start, nil
elseif source.type == 'string' then
- return '', nil
+ return source.start, nil
elseif source.type == 'integer'
or source.type == 'number'
or source.type == 'boolean'
@@ -532,6 +532,9 @@ function m.compileNode(noders, source)
local node = getNode(noders, id)
node.skip = true
end
+ if source.type == 'string' then
+ pushForward(noders, id, 'str:')
+ end
-- self -> mt:xx
if source.type == 'local' and source[1] == 'self' then
local func = guide.getParentFunction(source)
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 79e80577..839417fd 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -445,16 +445,14 @@ function m.searchRefsByID(status, uri, expect, mode)
end
end
- local function checkSpecial(id, node, field)
+ local function checkSpecial(id, field)
-- Special rule: ('').XX -> stringlib.XX
if id == 'str:'
or id == 'dn:string' then
if field or mode == 'field' then
searchID('dn:stringlib', field)
end
- return true
end
- return false
end
local function checkRequire(requireName, field)
@@ -556,14 +554,11 @@ function m.searchRefsByID(status, uri, expect, mode)
checkRequire(node.require, field)
end
- local isSepcial = checkSpecial(id, node, field)
- if not isSepcial then
- if node.forward then
- checkForward(id, node, field)
- end
- if node.backward then
- checkBackward(id, node, field)
- end
+ if node.forward then
+ checkForward(id, node, field)
+ end
+ if node.backward then
+ checkBackward(id, node, field)
end
if node.sources then
@@ -631,6 +626,7 @@ function m.searchRefsByID(status, uri, expect, mode)
return
end
end
+ checkSpecial(id, field)
local node = noder.getNodeByID(root, id)
if node then
searchNode(id, node, field)
diff --git a/test.lua b/test.lua
index 233475cd..2401bad9 100644
--- a/test.lua
+++ b/test.lua
@@ -9,7 +9,7 @@ local fs = require 'bee.filesystem'
ROOT = fs.path(rootPath)
TEST = true
DEVELOP = true
-FOOTPRINT = true
+TRACE = true
LOGPATH = LOGPATH or (ROOT .. '/log')
METAPATH = METAPATH or (ROOT .. '/meta')
diff --git a/test/definition/bug.lua b/test/definition/bug.lua
index 6d716471..fbc2b6a8 100644
--- a/test/definition/bug.lua
+++ b/test/definition/bug.lua
@@ -234,3 +234,11 @@ TEST [[
g[a.b.c] = 1
print(g.<?x?>)
]]
+
+TEST [[
+local function f()
+ return ''
+end
+
+local <?<!s!>?> = ''
+]]