From 65706920bff73e2d50048b977da65e7ede06f6f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 22 Jul 2022 17:37:18 +0800 Subject: [PATCH] fix #1368 --- changelog.md | 1 + script/vm/generic.lua | 13 ++++++++----- script/vm/runner.lua | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index e90796307..1cc80b85c 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ * `CHG` improve supports for multi-workspace * `FIX` [#1354](https://github.com/sumneko/lua-language-server/issues/1354) * `FIX` [#1355](https://github.com/sumneko/lua-language-server/issues/1355) +* `FIX` [#1368](https://github.com/sumneko/lua-language-server/issues/1368) ## 3.5.0 `2022-7-19` diff --git a/script/vm/generic.lua b/script/vm/generic.lua index 5163e155a..544e11c98 100644 --- a/script/vm/generic.lua +++ b/script/vm/generic.lua @@ -11,11 +11,11 @@ local mt = {} mt.__index = mt mt.type = 'generic' ----@param source vm.object +---@param source vm.object? ---@param resolved? table ----@return vm.object +---@return vm.object? local function cloneObject(source, resolved) - if not resolved then + if not resolved or not source then return source end if source.type == 'doc.generic.name' then @@ -126,8 +126,11 @@ function mt:resolve(uri, args) result:merge(nd) else ---@cast nd -vm.global - local clonedNode = vm.compileNode(cloneObject(nd, resolved)) - result:merge(clonedNode) + local clonedObject = cloneObject(nd, resolved) + if clonedObject then + local clonedNode = vm.compileNode(clonedObject) + result:merge(clonedNode) + end end end return result diff --git a/script/vm/runner.lua b/script/vm/runner.lua index 36bab8bfd..2f0479834 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -294,6 +294,7 @@ function mt:_lookIntoChild(action, topNode, outNode) end elseif action.type == 'local' then if action.value + and action.ref and action.value.type == 'select' then local index = action.value.sindex local call = action.value.vararg