diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-08 15:07:50 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-08 15:07:50 +0800 |
commit | 083656e8a1e558b5898915925d910ad035e8f615 (patch) | |
tree | 5b2d0795aa304386dc3df426d56817907d056f1e /script/parser | |
parent | 8cc8789fbff920f631859e8f9eba75e2448aa8c1 (diff) | |
download | lua-language-server-083656e8a1e558b5898915925d910ad035e8f615.zip |
update
Diffstat (limited to 'script/parser')
-rw-r--r-- | script/parser/guide.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index c0a1cd91..8d2708cf 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -968,4 +968,23 @@ function m.getPath(a, b, sameFunction) return mode, resultA, resultB end +---是否是全局变量(包括 _G.XXX 形式) +---@param source parser.guide.object +---@return boolean +function m.isGlobal(source) + if source.type == 'setglobal' + or source.type == 'getglobal' then + if source.node and source.node.tag == '_ENV' then + return true + end + end + if source.type == 'field' then + source = source.parent + end + if source.special == '_G' then + return true + end + return false +end + return m |