From 8d88695d3897384cdee001f49b702a1a3586597b 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, 25 Oct 2020 19:56:25 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/parser/guide.lua | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'script-beta/parser') diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 976ccd1e..0e79fb08 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -2514,6 +2514,21 @@ function m.getDocTypeNames(doc) end function m.inferByDoc(status, source) + while source.type == 'select' or source.type == 'call' do + local parent = source.parent + if parent.type == 'local' + or parent.type == 'setlocal' + or parent.type == 'setglobal' + or parent.type == 'setfield' + or parent.type == 'setmethod' + or parent.type == 'setindex' + or parent.type == 'tablefield' + or parent.type == 'tableindex' then + source = parent + else + break + end + end local binds = source.bindDocs if not binds then return @@ -3222,8 +3237,7 @@ function m.searchInfer(status, obj) status.cache.clock = status.cache.clock or osClock() end - local checked = m.inferByDoc(status, obj) - or m.inferCheckLibrary(status, obj) + local checked = m.inferCheckLibrary(status, obj) or m.inferCheckLiteral(status, obj) or m.inferCheckUnary(status, obj) or m.inferCheckBinary(status, obj) @@ -3235,6 +3249,7 @@ function m.searchInfer(status, obj) return end + m.inferByDoc(status, obj) if not status.simple then m.inferByDef(status, obj) end -- cgit v1.2.3