From 24543ab578b67bea57cf9f8c4817665a03515858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 10 Aug 2021 15:05:53 +0800 Subject: update --- script/core/noder.lua | 12 ++++++++++-- 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:() end ]] ---TEST [[ ------@class Dog ---local mt = {} ---function mt:() ---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:() ---end ---function mt2:doSomething() ---end ---]] +TEST [[ +---@class Dog +local mt = {} +function mt:() +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:() +end +function mt2:doSomething() +end +]] TEST [[ local function f() @@ -94,6 +94,15 @@ end local = f()() ]] + +TEST [[ +---@class A +local t + +---@class B: A +local +]] + -- TODO -- 泛型的反向搜索 do return end -- cgit v1.2.3