summaryrefslogtreecommitdiff
path: root/script/vm/operator.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-11-01 15:30:14 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-11-01 15:30:14 +0800
commit74e8cdc64719198018a565f438fa1ab66bfc71f5 (patch)
tree4265da1e0f839c339d69f0872fb6da16483b4f4f /script/vm/operator.lua
parentf050b38fd69bd1c90b99b536f89f8036c9f4fc3a (diff)
downloadlua-language-server-74e8cdc64719198018a565f438fa1ab66bfc71f5.zip
find reference respect `includeDeclaration`
Diffstat (limited to 'script/vm/operator.lua')
-rw-r--r--script/vm/operator.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/script/vm/operator.lua b/script/vm/operator.lua
index 9dea01c1..015eba38 100644
--- a/script/vm/operator.lua
+++ b/script/vm/operator.lua
@@ -273,7 +273,7 @@ vm.binarySwitch = util.switch()
or op == '//' and a // b
or op == '^' and a ^ b
vm.setNode(source, {
- type = math.type(result) == 'integer' and 'integer' or 'number',
+ type = (op == '//' or math.type(result) == 'integer') and 'integer' or 'number',
start = source.start,
finish = source.finish,
parent = source,
@@ -288,7 +288,6 @@ vm.binarySwitch = util.switch()
if op == '+'
or op == '-'
or op == '*'
- or op == '//'
or op == '%' then
local uri = guide.getUri(source)
local infer1 = vm.getInfer(source[1])
@@ -302,6 +301,10 @@ vm.binarySwitch = util.switch()
end
end
end
+ if op == '//' then
+ vm.setNode(source, node or vm.declareGlobal('type', 'integer'))
+ return
+ end
vm.setNode(source, node or vm.declareGlobal('type', 'number'))
end
end)