summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-22 17:51:15 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-22 17:51:15 +0800
commit05a098f7ed731b2a3a6d068d5e9d7dfeacc67be0 (patch)
tree7f14a20db22167613559ea154f90fdc9d6cdf042 /script/vm
parent65706920bff73e2d50048b977da65e7ede06f6f8 (diff)
downloadlua-language-server-05a098f7ed731b2a3a6d068d5e9d7dfeacc67be0.zip
fix #1363 don't lookup globals in blocks
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index fbc358a6..3d0464a4 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1736,7 +1736,7 @@ local function compileByGlobal(source)
if global.cate == 'variable' then
local hasMarkDoc
for _, set in ipairs(global:getSets(uri)) do
- if set.bindDocs then
+ if set.bindDocs and set.parent.type == 'main' then
if bindDocs(set) then
globalNode:merge(vm.compileNode(set))
hasMarkDoc = true
@@ -1751,7 +1751,7 @@ local function compileByGlobal(source)
vm.setNode(set, globalNode, true)
end
for _, set in ipairs(global:getSets(uri)) do
- if set.value and set.value.type ~= 'nil' then
+ if set.value and set.value.type ~= 'nil' and set.parent.type == 'main' then
if not hasMarkDoc or guide.isLiteral(set.value) then
globalNode:merge(vm.compileNode(set.value))
end