summaryrefslogtreecommitdiff
path: root/script/vm/global.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-01-13 16:28:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-01-13 16:28:54 +0800
commita3b5dcb6403bbcdd87e021f83e79c46796f68ce8 (patch)
tree51571a0dbcf4449abf9145311f4cb1da2477a13f /script/vm/global.lua
parent6c92b9a7cc10971e4ec6402fe9c23b1839c58c80 (diff)
downloadlua-language-server-a3b5dcb6403bbcdd87e021f83e79c46796f68ce8.zip
fix
Diffstat (limited to 'script/vm/global.lua')
-rw-r--r--script/vm/global.lua44
1 files changed, 23 insertions, 21 deletions
diff --git a/script/vm/global.lua b/script/vm/global.lua
index 0a90829a..19474bb5 100644
--- a/script/vm/global.lua
+++ b/script/vm/global.lua
@@ -546,31 +546,33 @@ function vm.compileByGlobal(source)
if not global then
return false
end
- if global.cate == 'type' then
- vm.setNode(source, global)
- return false
- end
vm.setNode(source, global)
- if guide.isAssign(source) then
- if vm.bindDocs(source) then
- return true
- end
- if source.value then
- vm.setNode(source, vm.compileNode(source.value))
+ if global.cate == 'variable' then
+ if guide.isAssign(source) then
+ if vm.bindDocs(source) then
+ return true
+ end
+ if source.value then
+ vm.setNode(source, vm.compileNode(source.value))
+ return true
+ end
+ else
+ if vm.bindAs(source) then
+ return true
+ end
+ local node = vm.traceNode(source)
+ if node then
+ vm.setNode(source, node, true)
+ return true
+ end
end
- return true
end
- local node = vm.traceNode(source)
- if node then
- vm.setNode(source, node, true)
- else
- local globalBase = vm.getGlobalBase(source)
- if not globalBase then
- return false
- end
- local globalNode = vm.compileNode(globalBase)
- vm.setNode(source, globalNode, true)
+ local globalBase = vm.getGlobalBase(source)
+ if not globalBase then
+ return false
end
+ local globalNode = vm.compileNode(globalBase)
+ vm.setNode(source, globalNode, true)
return true
end