diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-02-26 18:01:51 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-02-26 18:01:51 +0800 |
commit | 6de46624564d9bdf3d9c0f7614e5e5e399816ca6 (patch) | |
tree | 9f32043f4b962af38022e8d01a4afc4a87b8ea48 /server/src/vm/vm.lua | |
parent | 26d4be116440f38edc62927cf04603a6c1a7d17b (diff) | |
download | lua-language-server-6de46624564d9bdf3d9c0f7614e5e5e399816ca6.zip |
还是得共享info
Diffstat (limited to 'server/src/vm/vm.lua')
-rw-r--r-- | server/src/vm/vm.lua | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index 7301f1e0..9eb46c58 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -355,14 +355,8 @@ function mt:getName(name, source) end local ENV = self:loadLocal('_ENV') local ENVValue = ENV:getValue() - local global = ENVValue:getChild(name) - if global then - return global - else - global = self:createValue('any') - ENVValue:setChild(name, global) - return global - end + local global = ENVValue:getChild(name) or ENVValue:setChild(name, createValue('any', source)) + return global end function mt:setName(name, source, value) @@ -470,10 +464,10 @@ function mt:getSimple(simple, max) elseif source.type == 'index' then local child = source[1] local index = self:getIndex(child) - value = value:getChild(index) or createValue('any') + value = value:getChild(index) or value:setChild(index, createValue('any', source)) source:bindValue(value, 'get') elseif source.type == 'name' then - value = value:getChild(source[1]) or createValue('any') + value = value:getChild(source[1]) or value:setChild(source[1], createValue('any', source)) source:bindValue(value, 'get') elseif source.type == ':' then object = value |