summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-30 09:50:46 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-30 09:50:46 +0800
commit06ce7a427011fc9d941d7028013a234d29a93c19 (patch)
tree1936749a129aa8d50e9b736133dd9afa7b23da8f /server/src
parentfa33c7926f9ba018869d39d247a7f2e184d86261 (diff)
downloadlua-language-server-06ce7a427011fc9d941d7028013a234d29a93c19.zip
多次推断的结果叠加
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/value.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/server/src/core/value.lua b/server/src/core/value.lua
index a998d195..61882175 100644
--- a/server/src/core/value.lua
+++ b/server/src/core/value.lua
@@ -25,9 +25,8 @@ function mt:inference(tp, rate)
if not self._type then
self._type = {}
end
- if not self._type[tp] or rate > self._type[tp] then
- self._type[tp] = rate
- end
+ local current = self._type[tp] or 0.0
+ self._type[tp] = current + (1 - current) * rate
end
function mt:getType()