diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-08-11 18:39:51 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-08-11 18:39:51 +0800 |
commit | ed350080cfb3998fa95abb905cfa363f546e70ce (patch) | |
tree | 1c3f90dde731371cc0481b064a997472b1fc5243 /script | |
parent | ce2b607822d142afdcd0bd5ca7156b43ea011a56 (diff) | |
download | lua-language-server-ed350080cfb3998fa95abb905cfa363f546e70ce.zip |
fix stack overflow
Diffstat (limited to 'script')
-rw-r--r-- | script/vm/type.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/script/vm/type.lua b/script/vm/type.lua index dd7b359f..910d7960 100644 --- a/script/vm/type.lua +++ b/script/vm/type.lua @@ -143,6 +143,9 @@ end ---@param errs? typecheck.err[] ---@return boolean? local function checkChildEnum(childName, parent , uri, mark, errs) + if mark[childName] then + return + end local childClass = vm.getGlobal('type', childName) if not childClass then return nil @@ -157,11 +160,14 @@ local function checkChildEnum(childName, parent , uri, mark, errs) if not enums then return nil end + mark[childName] = true for _, enum in ipairs(enums) do if not vm.isSubType(uri, vm.compileNode(enum), parent, mark ,errs) then + mark[childName] = nil return false end end + mark[childName] = nil return true end |