diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-11-01 13:31:30 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-11-01 13:31:30 +0800 |
commit | e63ccd8fec249fdcade372f1c664733dacdc131e (patch) | |
tree | 45e6ed4dac31f375db45c50e55a12180a7294b9e /script/vm/global.lua | |
parent | 4d65d77f5214bf5dd935956c861580ff2b46bfe4 (diff) | |
download | lua-language-server-e63ccd8fec249fdcade372f1c664733dacdc131e.zip |
cleanup
Diffstat (limited to 'script/vm/global.lua')
-rw-r--r-- | script/vm/global.lua | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/script/vm/global.lua b/script/vm/global.lua index 86fd78cc..e94f9239 100644 --- a/script/vm/global.lua +++ b/script/vm/global.lua @@ -164,9 +164,11 @@ local function createGlobal(name, cate) }, mt) end +---@alias parser.enum string|integer + ---@class parser.object ----@field public _globalNode vm.global|false ----@field public _enums? (string|integer)[] +---@field package _globalNode vm.global|false +---@field package _enums? parser.enum[] ---@type table<string, vm.global> local allGlobals = {} @@ -324,14 +326,15 @@ local compilerGlobalSwitch = util.switch() source._globalNode = class if source.signs then - source._sign = vm.createSign() - for _, sign in ipairs(source.signs) do - source._sign:addSign(vm.compileNode(sign)) + local sign = vm.createSign() + vm.setSign(source, sign) + for _, obj in ipairs(source.signs) do + sign:addSign(vm.compileNode(obj)) end if source.extends then for _, ext in ipairs(source.extends) do if ext.type == 'doc.type.table' then - ext._generic = vm.createGeneric(ext, source._sign) + vm.setGeneric(ext, vm.createGeneric(ext, sign)) end end end @@ -540,6 +543,12 @@ function vm.getGlobalNode(source) end ---@param source parser.object +---@return parser.enum[]? +function vm.getEnums(source) + return source._enums +end + +---@param source parser.object local function compileSelf(source) if source.parent.type ~= 'funcargs' then return |