From 891ebf5760d7c7ac39cdcfa7042b33e93f4e9ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 16 Dec 2020 17:05:57 +0800 Subject: #306 --- script/files.lua | 1 + script/parser/guide.lua | 2 +- script/vm/getDocs.lua | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/script/files.lua b/script/files.lua index 71981a83..eb9fe97c 100644 --- a/script/files.lua +++ b/script/files.lua @@ -210,6 +210,7 @@ function m.removeAllClosed() end --- 遍历文件 +--- TODO: 协程不安全 function m.eachFile() return pairs(m.fileMap) end diff --git a/script/parser/guide.lua b/script/parser/guide.lua index ba858eaf..1f1ab48a 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -2263,7 +2263,7 @@ function m.pushResult(status, mode, ref, simple) end end if m.isLiteral(ref) - and ref.parent.type == 'callargs' + and ref.parent and ref.parent.type == 'callargs' and ref ~= simple.node then results[#results+1] = ref end diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua index 1c54d593..632dd1c2 100644 --- a/script/vm/getDocs.lua +++ b/script/vm/getDocs.lua @@ -51,6 +51,9 @@ local function getDocTypes(name) end function vm.getDocEnums(doc, mark, results) + if not doc then + return nil + end mark = mark or {} if mark[doc] then return nil -- cgit v1.2.3