diff options
author | sumneko <sumneko@hotmail.com> | 2022-03-06 21:40:34 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2022-03-06 21:40:34 +0800 |
commit | bd9566eb4c856d041e705be59e9b62b0a09d3ed4 (patch) | |
tree | 4e7454be8cd388a91c373b3ebf9cfe103455d39b /script/vm/compiler.lua | |
parent | aa6703f8e866cbc2cb50740000ad6ca1e46dd860 (diff) | |
download | lua-language-server-bd9566eb4c856d041e705be59e9b62b0a09d3ed4.zip |
update
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r-- | script/vm/compiler.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index aad5a836..5a6862c9 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -46,6 +46,34 @@ local searchFieldMap = util.switch() end end end) + : case 'doc.type.array' + : call(function (node, key, pushResult) + if type(key) == 'number' + and math.tointeger(key) + and key >= 1 then + pushResult(node.node) + end + end) + : case 'doc.type.table' + : call(function (node, key, pushResult) + for _, field in ipairs(node.fields) do + local fieldKey = field.name + if fieldKey.type == 'doc.type' then + local fieldNode = m.compileNode(fieldKey) + for fn in nodeMgr.eachNode(fieldNode) do + if fn.type == 'global' and fn.cate == 'type' then + if fn.name == 'any' + or (fn.name == 'boolean' and type(key) == 'boolean') + or (fn.name == 'number' and type(key) == 'number') + or (fn.name == 'integer' and math.tointeger(key)) + or (fn.name == 'string' and type(key) == 'string') then + pushResult(field.extends) + end + end + end + end + end + end) : getMap() |