diff options
-rw-r--r-- | script/core/noder.lua | 12 | ||||
-rw-r--r-- | test/references/all.lua | 49 |
2 files changed, 39 insertions, 22 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index 2e1313a2..102245d9 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -953,7 +953,14 @@ compileNodeMap = util.switch() pushForward(noders, getID(source.class), id) if source.extends then for _, ext in ipairs(source.extends) do - pushBackward(noders, id, getID(ext)) + pushBackward(noders, id, getID(ext), { + filter = function (_, field) + return field ~= nil + end, + filterValid = function (_, field) + return not field + end + }) end end if source.bindSources then @@ -1262,7 +1269,8 @@ function m.compileNode(noders, source) collector.subscribe(uri, id, noders) if guide.isSet(source) -- local t = Global --> t: g:.Global - and source.type ~= 'local' then + and source.type ~= 'local' + and source.type ~= 'setlocal' then local defID = 'def:' .. id collector.subscribe(uri, defID, noders) diff --git a/test/references/all.lua b/test/references/all.lua index 71d28215..5229c54b 100644 --- a/test/references/all.lua +++ b/test/references/all.lua @@ -37,26 +37,26 @@ function mt:<?x?>() end ]] ---TEST [[ ------@class Dog ---local mt = {} ---function mt:<?eat?>() ---end --- ------@class Master ---local mt2 = {} ---function mt2:init() --- ---@type Dog --- local foo = self:doSomething() --- ---@type Dog --- self.dog = getDog() ---end ---function mt2:feed() --- self.dog:<!eat!>() ---end ---function mt2:doSomething() ---end ---]] +TEST [[ +---@class Dog +local mt = {} +function mt:<?eat?>() +end + +---@class Master +local mt2 = {} +function mt2:init() + ---@type Dog + local foo = self:doSomething() + ---@type Dog + self.dog = getDog() +end +function mt2:feed() + self.dog:<!eat!>() +end +function mt2:doSomething() +end +]] TEST [[ local function f() @@ -94,6 +94,15 @@ end local <!y!> = f()() ]] + +TEST [[ +---@class A +local t + +---@class B: A +local <?v?> +]] + -- TODO -- 泛型的反向搜索 do return end |