diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-07-22 17:37:18 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-07-22 17:37:18 +0800 |
commit | 65706920bff73e2d50048b977da65e7ede06f6f8 (patch) | |
tree | 4b67c15aef704065fc291c1b2433c892e89595cd /script | |
parent | 5beb3ebb40250ad504f0d21b32148c44e9d9dc39 (diff) | |
download | lua-language-server-65706920bff73e2d50048b977da65e7ede06f6f8.zip |
fix #1368
Diffstat (limited to 'script')
-rw-r--r-- | script/vm/generic.lua | 13 | ||||
-rw-r--r-- | script/vm/runner.lua | 1 |
2 files changed, 9 insertions, 5 deletions
diff --git a/script/vm/generic.lua b/script/vm/generic.lua index 5163e155..544e11c9 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<string, vm.node> ----@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 36bab8bf..2f047983 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 |