summaryrefslogtreecommitdiff
path: root/script/vm/compiler.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-05 02:00:27 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-05 02:00:27 +0800
commit8661aaa67e749190c97ed2960bcc7453d6224876 (patch)
tree907b984ca5b4a758eccd1cbdfa7e69d458f84003 /script/vm/compiler.lua
parentb04ad0cbe77602f739cb35d7ba838a1f62d298dd (diff)
downloadlua-language-server-8661aaa67e749190c97ed2960bcc7453d6224876.zip
update
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r--script/vm/compiler.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 1473b985..c1ed4e95 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -103,6 +103,7 @@ local searchFieldSwitch = util.switch()
function m.getClassFields(node, key, pushResult)
local mark = {}
+
local function searchClass(class)
local name = class.name
if mark[name] then
@@ -151,7 +152,21 @@ function m.getClassFields(node, key, pushResult)
end
end
end
+
+ local function searchGlobal(class)
+ if class.cate == 'type' and class.name == '_G' then
+ local globals = globalMgr.getGlobals('variable')
+ for _, global in ipairs(globals) do
+ local sets = global:getSets()
+ for _, set in ipairs(sets) do
+ pushResult(set)
+ end
+ end
+ end
+ end
+
searchClass(node)
+ searchGlobal(node)
end
---@class parser.object