diff options
author | sumneko <sumneko@hotmail.com> | 2022-03-11 02:03:30 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2022-03-11 02:03:30 +0800 |
commit | 9512eec020d1ee186d3fe684cd9c2493c5672fc7 (patch) | |
tree | adcc0276bd04058a4ab83f8705900cb292cead25 /script/vm/compiler.lua | |
parent | 54b1e1123f242e5b5ffe8cc5ca51afe3cf18b4a1 (diff) | |
download | lua-language-server-9512eec020d1ee186d3fe684cd9c2493c5672fc7.zip |
update
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r-- | script/vm/compiler.lua | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 6be6e672..da38c334 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -566,6 +566,33 @@ local compilerMap = util.switch() : call(function (source) nodeMgr.setNode(source, source) end) + : case 'doc.type.name' + : call(function (source) + if source.signs then + nodeMgr.setNode(source, source) + local global = globalMgr.getGlobal('type', source[1]) + for _, set in ipairs(global:getSets()) do + if set.type == 'doc.class' then + if set.extends then + for _, ext in ipairs(set.extends) do + if ext.type == 'doc.type.table' then + if ext._generic then + local resolved = ext._generic:resolve(source.signs) + nodeMgr.setNode(source, resolved) + end + end + end + end + end + if set.type == 'doc.alias' then + if set.extends._generic then + local resolved = set.extends._generic:resolve(source.signs) + nodeMgr.setNode(source, resolved) + end + end + end + end + end) : case 'doc.field' : call(function (source) nodeMgr.setNode(source, m.compileNode(source.extends)) @@ -1035,28 +1062,6 @@ local function compileByGlobal(source) end if source._globalNode then nodeMgr.setNode(source, m.compileNode(source._globalNode)) - if source._globalNode.cate == 'type' then - for _, set in ipairs(source._globalNode:getSets()) do - if set.type == 'doc.class' then - if set.extends then - for _, ext in ipairs(set.extends) do - if ext.type == 'doc.type.table' then - if ext._generic then - local resolved = ext._generic:resolve(source.signs) - nodeMgr.setNode(source, resolved) - end - end - end - end - end - if set.type == 'doc.alias' then - if set.extends._generic then - local resolved = set.extends._generic:resolve(source.signs) - nodeMgr.setNode(source, resolved) - end - end - end - end return end end |