summaryrefslogtreecommitdiff
path: root/script-beta/core/hover/label.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-16 16:20:12 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-16 16:20:12 +0800
commit68f6df0181c8c5e499b571c0447af9203d3fd6d9 (patch)
tree6d44c1dfd98a57e01ca1482deb4cc8206ddb9c33 /script-beta/core/hover/label.lua
parent8fdeec14b4a90e1f15ed639ebc7b7b423e100424 (diff)
downloadlua-language-server-68f6df0181c8c5e499b571c0447af9203d3fd6d9.zip
整理代码
Diffstat (limited to 'script-beta/core/hover/label.lua')
-rw-r--r--script-beta/core/hover/label.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/script-beta/core/hover/label.lua b/script-beta/core/hover/label.lua
index 5e14c68e..a776f0c4 100644
--- a/script-beta/core/hover/label.lua
+++ b/script-beta/core/hover/label.lua
@@ -18,17 +18,19 @@ end
local function asValue(source, title)
local name = buildName(source)
- local class, type, literal, cont
- local values = vm.getValue(source)
+ local class = 'any'
+ local type = 'any'
+ local literal, cont
+ local values = vm.getInfers(source)
if values then
for _, value in ipairs(values) do
local src = value.source
local tp = value.type
- class = guide.mergeInfers(class, vm.getClass(src))
- type = guide.mergeInfers(type, tp)
+ class = guide.mergeTypes {class, vm.getClass(src)}
+ type = guide.mergeTypes {type, tp}
local sl = vm.getLiteral(src)
if sl then
- literal = guide.mergeInfers(literal, util.viewLiteral(sl))
+ literal = guide.mergeTypes {literal, util.viewLiteral(sl)}
end
if tp == 'table' then
cont = buildTable(src)
@@ -36,11 +38,11 @@ local function asValue(source, title)
end
end
vm.eachDef(source, function (src)
- class = guide.mergeInfers(class, vm.getClass(src))
- type = guide.mergeInfers(type, vm.getType(src))
+ class = guide.mergeTypes {class, vm.getClass(src)}
+ type = guide.mergeTypes {type, vm.getType(src)}
local sl = vm.getLiteral(src)
if sl then
- literal = guide.mergeInfers(literal, util.viewLiteral(sl))
+ literal = guide.mergeTypes {literal, util.viewLiteral(sl)}
end
if type == 'table' then
cont = buildTable(src)