diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-09 19:14:48 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-09 19:14:48 +0800 |
commit | adc1c62a5af178825d5c275f53ed0836f0836078 (patch) | |
tree | 9d53390f2ef3d24bdf95391dd57a396171bcb9cd /server/src/vm/value.lua | |
parent | 4fe47715dacfb18e79848a55f4e1b4d2607b0efd (diff) | |
download | lua-language-server-adc1c62a5af178825d5c275f53ed0836f0836078.zip |
非 Lua 5.3 或 Lua 5.4 时,将 integer 退化为 number
Diffstat (limited to 'server/src/vm/value.lua')
-rw-r--r-- | server/src/vm/value.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua index 625066b1..48b74bee 100644 --- a/server/src/vm/value.lua +++ b/server/src/vm/value.lua @@ -1,6 +1,7 @@ local libraryBuilder = require 'vm.library' local library = require 'core.library' local listMgr = require 'vm.list' +local config = require 'config' local Sort = 0 local Watch = setmetatable({}, {__mode = 'kv'}) @@ -79,6 +80,12 @@ function mt:setType(tp, rate) if tp == 'any' or tp == 'nil' then rate = 0.0 end + if tp == 'integer' then + local version = config.config.runtime.version + if version ~= 'Lua 5.3' and version ~= 'Lua 5.4' then + tp = 'number' + end + end local current = self._type[tp] or 0.0 self._type[tp] = current + (1 - current) * rate end |