summaryrefslogtreecommitdiff
path: root/server/src/vm
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-16 15:24:52 +0800
committersumneko <sumneko@hotmail.com>2019-04-16 15:24:52 +0800
commitf406daaa8633afb61078a060b509c32675b6f612 (patch)
tree53a560457dd837d8d2eee28da4ee4d75f1249707 /server/src/vm
parent20b609862d1536b1aa6befdca3eef9dedb58fc91 (diff)
downloadlua-language-server-f406daaa8633afb61078a060b509c32675b6f612.zip
类型推断取最大值而不是叠加
Diffstat (limited to 'server/src/vm')
-rw-r--r--server/src/vm/value.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua
index 425cc0b2..c93fda90 100644
--- a/server/src/vm/value.lua
+++ b/server/src/vm/value.lua
@@ -70,7 +70,9 @@ function mt:setType(tp, rate)
end
end
local current = self._type[tp] or 0.0
- self._type[tp] = current + (1 - current) * rate
+ if rate > current then
+ self._type[tp] = rate
+ end
end
function mt:getType()