diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-18 01:03:25 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-18 01:03:25 +0800 |
commit | 6df9d8376bc5339a8c4218cc261dc76d7ac8e7ad (patch) | |
tree | a6e13efaf733f6b3ef618ece150aa1fb3579f456 /script/vm/compiler.lua | |
parent | 7b35e39b5eae7c3445cd9ec4d16637185bc26b93 (diff) | |
download | lua-language-server-6df9d8376bc5339a8c4218cc261dc76d7ac8e7ad.zip |
update
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r-- | script/vm/compiler.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index bc85407d..36b826ae 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -1086,6 +1086,18 @@ local binarySwich = util.switch() [1] =result, }) else + if op == '+' + or op == '-' + or op == '*' + or op == '//' + or op == '%' then + local uri = guide.getUri(source) + if vm.getInfer(source[1]):view(uri) == 'integer' + and vm.getInfer(source[2]):view(uri) == 'integer' then + vm.setNode(source, vm.declareGlobal('type', 'integer')) + return + end + end vm.setNode(source, vm.declareGlobal('type', 'number')) end end) |