diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-28 16:08:03 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-28 16:08:03 +0800 |
commit | 3eddd7eb2f4e22f29b1cc286e06dea345991da18 (patch) | |
tree | 342bcf86c2d7f2bbc18d7108e496d8b1ff3fa8e0 /server/src/core/vm.lua | |
parent | 3342b201614baeb067e29b7941e26807ff13a244 (diff) | |
download | lua-language-server-3eddd7eb2f4e22f29b1cc286e06dea345991da18.zip |
更新
Diffstat (limited to 'server/src/core/vm.lua')
-rw-r--r-- | server/src/core/vm.lua | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua index 1291383b..b7eb2535 100644 --- a/server/src/core/vm.lua +++ b/server/src/core/vm.lua @@ -1038,15 +1038,15 @@ function mt:getBinary(exp) v2:inference('string', 0.1) if math.type(v1:getValue()) == 'integer' and math.type(v2:getValue()) == 'integer' then if op == '|' then - return self:createValue('integer', v1:getValue() | v2:getValue()) + return self:createValue('integer', exp, v1:getValue() | v2:getValue()) elseif op == '~' then - return self:createValue('integer', v1:getValue() ~ v2:getValue()) + return self:createValue('integer', exp, v1:getValue() ~ v2:getValue()) elseif op == '&' then - return self:createValue('integer', v1:getValue() &v2:getValue()) + return self:createValue('integer', exp, v1:getValue() &v2:getValue()) elseif op == '<<' then - return self:createValue('integer', v1:getValue() << v2:getValue()) + return self:createValue('integer', exp, v1:getValue() << v2:getValue()) elseif op == '>>' then - return self:createValue('integer', v1:getValue() >> v2:getValue()) + return self:createValue('integer', exp, v1:getValue() >> v2:getValue()) end end return self:createValue('integer') @@ -1071,24 +1071,24 @@ function mt:getBinary(exp) v2:inference('number', 0.9) if type(v1:getValue()) == 'number' and type(v2:getValue()) == 'number' then if op == '+' then - return self:createValue('number', nil, v1:getValue() + v2:getValue()) + return self:createValue('number', exp, v1:getValue() + v2:getValue()) elseif op == '-' then - return self:createValue('number', nil, v1:getValue() - v2:getValue()) + return self:createValue('number', exp, v1:getValue() - v2:getValue()) elseif op == '*' then - return self:createValue('number', nil, v1:getValue() * v2:getValue()) + return self:createValue('number', exp, v1:getValue() * v2:getValue()) elseif op == '/' then if v2:getValue() ~= 0 then - return self:createValue('number', nil, v1:getValue() / v2:getValue()) + return self:createValue('number', exp, v1:getValue() / v2:getValue()) end elseif op == '^' then - return self:createValue('number', nil, v1:getValue() ^ v2:getValue()) + return self:createValue('number', exp, v1:getValue() ^ v2:getValue()) elseif op == '%' then if v2:getValue() ~= 0 then - return self:createValue('number', nil, v1:getValue() % v2:getValue()) + return self:createValue('number', exp, v1:getValue() % v2:getValue()) end elseif op == '//' then if v2:getValue() ~= 0 then - return self:createValue('number', nil, v1:getValue() // v2:getValue()) + return self:createValue('number', exp, v1:getValue() // v2:getValue()) end end end @@ -1108,19 +1108,19 @@ function mt:getUnary(exp) v1:inference('table', 0.9) v1:inference('string', 0.9) if type(v1:getValue()) == 'string' then - return self:createValue('integer', nil, #v1:getValue()) + return self:createValue('integer', exp, #v1:getValue()) end return self:createValue('integer') elseif op == '-' then v1:inference('number', 0.9) if type(v1:getValue()) == 'number' then - return self:createValue('number', nil, -v1:getValue()) + return self:createValue('number', exp, -v1:getValue()) end return self:createValue('number') elseif op == '~' then v1:inference('integer', 0.9) if math.type(v1:getValue()) == 'integer' then - return self:createValue('integer', nil, ~v1:getValue()) + return self:createValue('integer', exp, ~v1:getValue()) end return self:createValue('integer') end |