diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-04 17:31:27 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-04 17:31:27 +0800 |
commit | 399c008ba189fe22716d46d2974de1569b1d39e8 (patch) | |
tree | 7ba2d3b7c4f5099a8fe5ea5a1e5c68e0a7861485 /script/vm/compiler.lua | |
parent | 171ed306f84850be46620145358dcfdf37387de2 (diff) | |
download | lua-language-server-399c008ba189fe22716d46d2974de1569b1d39e8.zip |
update
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r-- | script/vm/compiler.lua | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 84de7058..7053e61c 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -238,6 +238,13 @@ local function bindDocs(source) m.setNode(source, m.compileNode(doc)) end end + if doc.type == 'doc.class' then + if source.type == 'local' + or (source._globalNode and guide.isSet(source)) then + hasFounded = true + m.setNode(source, m.compileNode(doc)) + end + end if doc.type == 'doc.param' then if isParam and source[1] == doc.param[1] then hasFounded = true @@ -360,26 +367,10 @@ local compilerMap = util.switch() m.setNode(source, m.compileNode(typeUnit)) end end) - : case 'doc.type.name' - : call(function (source) - local name = source[1] - local uri = guide.getUri(source) - local type = globalMgr.declareGlobal('type', name, uri) - type:addGet(uri, source) - m.setNode(source, type) - end) : case 'doc.field' : call(function (source) m.setNode(source, m.compileNode(source.extends)) end) - : case 'doc.extends.name' - : call(function (source) - local name = source[1] - local uri = guide.getUri(source) - local type = globalMgr.declareGlobal('type', name, uri) - type:addGet(uri, source) - m.setNode(source, type) - end) : case 'doc.param' : call(function (source) m.setNode(source, m.compileNode(source.extends)) @@ -410,6 +401,13 @@ local compilerMap = util.switch() : call(function (source) m.setNode(source, m.compileNode(source.overload)) end) + : case 'doc.see.name' + : call(function (source) + local type = globalMgr.getGlobal('type', source[1]) + if type then + m.setNode(source, m.compileNode(type)) + end + end) : getMap() ---@param source parser.object @@ -428,9 +426,11 @@ local function compileByGlobal(source) end if source._globalNode then m.setNode(source, source._globalNode) - for _, set in ipairs(source._globalNode:getSets()) do - if set.value then - m.setNode(source, m.compileNode(set.value)) + if source._globalNode.cate == 'variable' then + for _, set in ipairs(source._globalNode:getSets()) do + if set.value then + m.setNode(source, m.compileNode(set.value)) + end end end return |