diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-16 19:34:38 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-16 19:34:38 +0800 |
commit | 85f2cf816e5b3e2d439731e48129678a32b70d60 (patch) | |
tree | 12b8659be0c00577f97a0265fe041afdf2a5dfd4 /script-beta/parser/guide.lua | |
parent | 13ebfd293897200bda9cb1840fef6cb03a9c6d43 (diff) | |
download | lua-language-server-85f2cf816e5b3e2d439731e48129678a32b70d60.zip |
暂存
Diffstat (limited to 'script-beta/parser/guide.lua')
-rw-r--r-- | script-beta/parser/guide.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 863d828e..835e62ba 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1846,16 +1846,15 @@ function m.allocInfer(o) -- TODO assert(o.type) if type(o.type) == 'table' then - local values = {} + local infers = {} for i = 1, #o.type do - local sub = { + infers[i] = { type = o.type[i], value = o.value, source = o.source, } - values[i] = sub end - return values + return infers else return { [1] = o, @@ -1865,9 +1864,11 @@ end function m.mergeTypes(infers) local types = {} + local mark = {} for i = 1, #infers do for tp in infers[i]:gmatch '[^|]+' do - if not types[tp] and tp ~= 'any' then + if not mark[tp] and tp ~= 'any' then + mark[tp] = true types[#types+1] = tp end end @@ -2733,6 +2734,9 @@ function m.cleanInfers(infers) local mark = {} for i = 1, #infers do local infer = infers[i] + if not infer then + return + end local key = ('%s|%p'):format(infer.type, infer.source) if mark[key] then infers[i] = infers[#infers] |