From 80f8f5bdda5a0401f28a83ea9dd649309ad16c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sun, 10 Nov 2019 21:18:25 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/core/diagnostics/unused-function.lua | 5 ++--- server-beta/src/searcher/getGlobals.lua | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server-beta/src/core/diagnostics/unused-function.lua b/server-beta/src/core/diagnostics/unused-function.lua index 0886660d..0dd55906 100644 --- a/server-beta/src/core/diagnostics/unused-function.lua +++ b/server-beta/src/core/diagnostics/unused-function.lua @@ -10,11 +10,10 @@ return function (uri, callback) return end guide.eachSourceType(ast.ast, 'function', function (source) - local hasGet local hasSet - searcher.eachRef(source, function (info) + local hasGet = searcher.eachRef(source, function (info) if info.mode == 'get' then - hasGet = true + return true elseif info.mode == 'set' or info.mode == 'declare' then hasSet = true diff --git a/server-beta/src/searcher/getGlobals.lua b/server-beta/src/searcher/getGlobals.lua index 56c489bd..4519985b 100644 --- a/server-beta/src/searcher/getGlobals.lua +++ b/server-beta/src/searcher/getGlobals.lua @@ -13,6 +13,9 @@ local function getGlobals(source) end mark[src] = true local name = info.key + if not name then + return + end if not cache[name] then cache[name] = { key = name, -- cgit v1.2.3