From af4e3094bd5592d2e9d6a769ef1d7a1660b3e48e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 9 Apr 2022 02:33:17 +0800 Subject: update --- script/vm/ref.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'script/vm/ref.lua') diff --git a/script/vm/ref.lua b/script/vm/ref.lua index f7f1a6d1..e1bdf81d 100644 --- a/script/vm/ref.lua +++ b/script/vm/ref.lua @@ -135,21 +135,21 @@ local function searchField(source, pushResult, defMap, fileNotify) end ---@async guide.eachSourceType(state.ast, 'getfield', function (src) - if src.field[1] == key then + if src.field and src.field[1] == key then checkDef(src) await.delay() end end) ---@async guide.eachSourceType(state.ast, 'getmethod', function (src) - if src.method[1] == key then + if src.method and src.method[1] == key then checkDef(src) await.delay() end end) ---@async guide.eachSourceType(state.ast, 'getindex', function (src) - if src.index.type == 'string' and src.index[1] == key then + if src.index and src.index.type == 'string' and src.index[1] == key then checkDef(src) await.delay() end @@ -269,11 +269,12 @@ local function searchByNode(source, pushResult) end local function searchByDef(source, pushResult) + local defMap = {} if source.type == 'function' or source.type == 'doc.type.function' then - return + defMap[source] = true + return defMap end - local defMap = {} local defs = vm.getDefs(source) for _, def in ipairs(defs) do pushResult(def) -- cgit v1.2.3