diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-03-01 14:34:14 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-03-01 14:34:14 +0800 |
commit | 9898f87795b5c3cf096197c6f9c92e368addb2a3 (patch) | |
tree | 3c57f328413d6095f57c482759aa89af3e0ee6fe /script/core | |
parent | ead187327a6d8d42612856f6e9de153a1994a836 (diff) | |
download | lua-language-server-9898f87795b5c3cf096197c6f9c92e368addb2a3.zip |
clean up code
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/hover/return.lua | 4 | ||||
-rw-r--r-- | script/core/hover/table.lua | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/script/core/hover/return.lua b/script/core/hover/return.lua index 3829dbed..0ad39970 100644 --- a/script/core/hover/return.lua +++ b/script/core/hover/return.lua @@ -66,12 +66,12 @@ local function asFunction(source) for _, value in ipairs(values) do if value.type then for tp in value.type:gmatch '[^|]+' do - types[#types+1] = tp + types[tp] = true end end end end - if #types > 0 or rtn[1] then + if next(types) or rtn[1] then local tp = mergeTypes(types) or 'any' if rtn[1].name then line[#line+1] = ('%s%s: %s'):format( diff --git a/script/core/hover/table.lua b/script/core/hover/table.lua index 58e64951..f46e722e 100644 --- a/script/core/hover/table.lua +++ b/script/core/hover/table.lua @@ -189,7 +189,7 @@ local function mergeTypes(types) for tp in tv:gmatch '[^|]+' do if not mark[tp] then mark[tp] = true - results[#results+1] = tp + results[tp] = true end end end |