diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-03-10 21:03:07 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-03-10 21:03:07 +0800 |
commit | 8a7c94965cf6c632b3b85956f0e64928df8dc42d (patch) | |
tree | d1fe2fba7af02d740acd0b83c8de46b0ea236fab /script/vm/compiler.lua | |
parent | 04601c7da4a485d84be5e0b9864acf27f978c275 (diff) | |
download | lua-language-server-8a7c94965cf6c632b3b85956f0e64928df8dc42d.zip |
update
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r-- | script/vm/compiler.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 390387b4..c7f5ad84 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -432,6 +432,7 @@ local compilerMap = util.switch() nodeMgr.setNode(source, m.compileNode(source.value)) end end + local hasMarkParam -- function x.y(self, ...) --> function x:y(...) if source[1] == 'self' and not hasMarkDoc @@ -439,9 +440,13 @@ local compilerMap = util.switch() and source.parent[1] == source then local setfield = source.parent.parent.parent if setfield.type == 'setfield' then + hasMarkParam = true nodeMgr.setNode(source, m.compileNode(setfield.node)) end end + if source.parent.type == 'funcargs' and not hasMarkDoc and not hasMarkParam then + nodeMgr.setNode(source, globalMgr.getGlobal('type', 'any')) + end -- for x in ... do if source.parent.type == 'in' then m.compileNode(source.parent) @@ -601,6 +606,14 @@ local compilerMap = util.switch() nodeMgr.setNode(source, m.compileNode(type)) end end) + : case 'doc.type.arg' + : call(function (source) + if source.extends then + nodeMgr.setNode(source, m.compileNode(source.extends)) + else + nodeMgr.setNode(source, globalMgr.getGlobal('type', 'any')) + end + end) : case 'unary' : call(function (source) local valueMgr = require 'vm.value' |