diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-10-10 14:09:12 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-10-10 14:09:12 +0800 |
commit | 8ea5794f59f4608faacc727cf11a41f0f751ddd1 (patch) | |
tree | 30a03b97072cdd86ba239c95fb813fe6c45e217b /server-beta/src/core | |
parent | 51216d347b59e33fcad96400ddae262971ede712 (diff) | |
download | lua-language-server-8ea5794f59f4608faacc727cf11a41f0f751ddd1.zip |
简化 _G 的实现
Diffstat (limited to 'server-beta/src/core')
-rw-r--r-- | server-beta/src/core/local.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server-beta/src/core/local.lua b/server-beta/src/core/local.lua index 79b16770..1a9c1644 100644 --- a/server-beta/src/core/local.lua +++ b/server-beta/src/core/local.lua @@ -58,6 +58,19 @@ function m:field(source, key, callback) elseif ref.type == 'getglobal' then -- _ENV.XXX callback(ref, 'get') + if self:getSpecial(ref) == 's|_G' then + local parent = ref.parent + local tp = parent.type + if tp == 'setfield' + or tp == 'setmethod' + or tp == 'setindex' then + callback(parent, 'set') + elseif tp == 'getfield' + or tp == 'getmethod' + or tp == 'getindex' then + callback(parent, 'get') + end + end elseif ref.type == 'setglobal' then -- _ENV.XXX = XXX callback(ref, 'set') |