diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-09 21:51:33 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-09 21:51:33 +0800 |
commit | af024872678d83e51a110ed96a8b6967acfecdc4 (patch) | |
tree | fdaa958ef9a979f957da266e1c04974a3b24a8f3 /script-beta/parser/guide.lua | |
parent | f599f416d7ada3a1824f4f8250a5b5e89da2ac09 (diff) | |
download | lua-language-server-af024872678d83e51a110ed96a8b6967acfecdc4.zip |
只有 doc.class 与 doc.type 才会跳过推测
Diffstat (limited to 'script-beta/parser/guide.lua')
-rw-r--r-- | script-beta/parser/guide.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index c9f4eb48..88a09481 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1401,6 +1401,7 @@ function m.checkSameSimpleByBindDocs(status, obj, start, queue, mode) if status.cache.searchingBindedDoc then return end + local skipInfer = false local results = {} for _, doc in ipairs(obj.bindDocs) do if doc.type == 'doc.class' then @@ -1447,6 +1448,7 @@ function m.checkSameSimpleByBindDocs(status, obj, start, queue, mode) m.searchRefs(newStatus, ref, mode) end end + skipInfer = true end if res.type == 'doc.type.function' then queue[#queue+1] = { @@ -1468,7 +1470,7 @@ function m.checkSameSimpleByBindDocs(status, obj, start, queue, mode) force = true, } end - return true + return skipInfer end function m.checkSameSimpleInArg1OfSetMetaTable(status, obj, start, queue) @@ -1775,9 +1777,6 @@ function m.searchSameFieldsInValue(status, ref, start, queue, mode) } -- 检查形如 a = f() 的分支情况 m.checkSameSimpleInCall(status, value, start, queue, mode) - - -- 检查自己是字面量表的情况 - --m.checkSameSimpleInValueOfTable(status, value, start, queue) end function m.checkSameSimpleAsTableField(status, ref, start, queue) @@ -1994,8 +1993,8 @@ function m.checkSameSimple(status, simple, data, mode, queue) cmode = 'ref' end -- 检查 doc - local hasDoc = m.checkSameSimpleByBindDocs(status, ref, i, queue, cmode) - if not hasDoc then + local skipInfer = m.checkSameSimpleByBindDocs(status, ref, i, queue, cmode) + if not skipInfer then -- 穿透 self:func 与 mt:func m.searchSameFieldsCrossMethod(status, ref, i, queue) -- 穿透赋值 |