diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-14 17:39:10 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-14 17:39:10 +0800 |
commit | 2b0fcec7b17c2c01942a277e938f918dc52ff62c (patch) | |
tree | 1fb512602ddea0bd4239746f79c513028aeb9bbf | |
parent | fd123ac1fd6d849d7ace9cc49dd3ab645da62544 (diff) | |
download | lua-language-server-2b0fcec7b17c2c01942a277e938f918dc52ff62c.zip |
update runner
-rw-r--r-- | script/vm/runner.lua | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/script/vm/runner.lua b/script/vm/runner.lua index 8823486d..2e301ed3 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -79,8 +79,30 @@ function mt:_fastWard(pos, node) if newNode then node = newNode:copy() end - else - error('unexpected type: ' .. obj.type) + elseif obj.type == 'doc.cast' then + node = node:copy() + for _, cast in ipairs(obj.casts) do + if cast.mode == '+' then + if cast.optional then + node:addOptional() + end + if cast.extends then + node:merge(vm.compileNode(cast.extends)) + end + elseif cast.mode == '-' then + if cast.optional then + node:removeOptional() + end + if cast.extends then + node:removeNode(vm.compileNode(cast.extends)) + end + else + if cast.extends then + node:clear() + node:merge(vm.compileNode(cast.extends)) + end + end + end end end self._index = math.huge |