diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-15 13:39:25 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-15 13:39:25 +0800 |
commit | 035143c078f9e87b92a909b415d4d060db155604 (patch) | |
tree | bc53590d20bbfceb8ee3968793d3bc408ae4081f /server/src | |
parent | 37c2aaca32959f6c7862d7120379482f3ce811a3 (diff) | |
download | lua-language-server-035143c078f9e87b92a909b415d4d060db155604.zip |
库函数返回常量时使用新建值
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/vm/vm.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index 4a0250f1..555154b3 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -288,6 +288,9 @@ function mt:callLibrary(func, values, source, lib) if rtn.type == '...' then --func:getReturn(i):setType('any', 0.0) else + if rtn.type == 'boolean' or rtn.type == 'number' or rtn.type == 'integer' or rtn.type == 'string' then + func:setReturn(i, self:createValue(rtn.type, self:getDefaultSource())) + end func:getReturn(i):setType(rtn.type or 'any', 1.0) end end |