diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-22 15:54:11 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-22 15:54:11 +0800 |
commit | 4d6f36e241d2bbda3fa28fb32e60d534e87a7ece (patch) | |
tree | a43c57f8e44d7e4ab6f3658f54304f420f3d0023 /server-beta/src/vm | |
parent | fbd1394858972c92439d927fa30dabcfd55dc705 (diff) | |
download | lua-language-server-4d6f36e241d2bbda3fa28fb32e60d534e87a7ece.zip |
更新 hover
Diffstat (limited to 'server-beta/src/vm')
-rw-r--r-- | server-beta/src/vm/getValue.lua | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/server-beta/src/vm/getValue.lua b/server-beta/src/vm/getValue.lua index 07ebe2a5..ee486a54 100644 --- a/server-beta/src/vm/getValue.lua +++ b/server-beta/src/vm/getValue.lua @@ -30,10 +30,26 @@ local function merge(t, b) end local function alloc(o) - return { - [1] = o, - [o] = true, - } + -- TODO + assert(o.type) + if type(o.type) == 'table' then + local values = {} + for i = 1, #o.type do + local sub = { + type = o.type[i], + value = o.value, + source = o.source, + } + values[i] = sub + values[sub] = true + end + return values + else + return { + [1] = o, + [o] = true, + } + end end local function insert(t, o) @@ -758,8 +774,10 @@ function vm.getLiteral(source, type) end for i = 1, #values do local v = values[i] - if v.type == type and v.value ~= nil then - return v.value + if v.value ~= nil then + if type == nil or v.type == type then + return v.value + end end end return nil |