summaryrefslogtreecommitdiff
path: root/script-beta/core/hover/table.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-09-07 19:12:22 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-09-07 19:12:22 +0800
commitfead5452806b9bab4b3f7cf3fe73f88161bd5872 (patch)
treee08eea8d03c51ea32c6a558ebb996c382b5c6ce1 /script-beta/core/hover/table.lua
parenta6f72712443e9c96e94d680e4bc394d89dffe577 (diff)
downloadlua-language-server-fead5452806b9bab4b3f7cf3fe73f88161bd5872.zip
field的最后一级不能检查反向引用
Diffstat (limited to 'script-beta/core/hover/table.lua')
-rw-r--r--script-beta/core/hover/table.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/script-beta/core/hover/table.lua b/script-beta/core/hover/table.lua
index f16eed9b..63ad800e 100644
--- a/script-beta/core/hover/table.lua
+++ b/script-beta/core/hover/table.lua
@@ -109,7 +109,6 @@ end
return function (source)
local literals = {}
local classes = {}
- local intValue = true
vm.eachField(source, function (src)
local key, class, literal = getField(src)
if not classes[key] then
@@ -120,11 +119,6 @@ return function (source)
end
classes[key][#classes[key]+1] = class
literals[key][#literals[key]+1] = literal
- if class ~= 'integer'
- or not literals[key]
- or #literals[key] ~= 1 then
- intValue = false
- end
end)
for key, class in pairs(classes) do
classes[key] = guide.mergeTypes(class)
@@ -136,6 +130,13 @@ return function (source)
if not next(classes) then
return '{}'
end
+ local intValue = true
+ for key, class in pairs(classes) do
+ if class ~= 'integer' or not tonumber(literals[key]) then
+ intValue = false
+ break
+ end
+ end
if intValue then
return buildAsConst(classes, literals)
else