summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authoralwo <albrecht.woess@signum.plus>2023-03-28 14:52:18 +0200
committeralwo <albrecht.woess@signum.plus>2023-03-28 14:52:18 +0200
commit429c48fcb453aeb2de0df55492895d51ad9596f0 (patch)
tree47b4b4583aefd4693cde2395ab063c0e96a8f27c /script
parent1c6148fe5c3b5661ace0f0b6d954449a536ff8c9 (diff)
parent3a761da3d574639aac1f7ef06b1976bf3f255ad3 (diff)
downloadlua-language-server-429c48fcb453aeb2de0df55492895d51ad9596f0.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'script')
-rw-r--r--script/vm/operator.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/script/vm/operator.lua b/script/vm/operator.lua
index 9c68e648..5c63387a 100644
--- a/script/vm/operator.lua
+++ b/script/vm/operator.lua
@@ -316,6 +316,27 @@ vm.binarySwitch = util.switch()
return
end
end
+ if op == '/'
+ or op == '^' then
+ local uri = guide.getUri(source)
+ local infer1 = vm.getInfer(source[1])
+ local infer2 = vm.getInfer(source[2])
+ if (infer1:hasType(uri, 'integer') or infer1:hasType(uri, 'number'))
+ and (infer2:hasType(uri, 'integer') or infer2:hasType(uri, 'number')) then
+ vm.setNode(source, vm.declareGlobal('type', 'number'))
+ return
+ end
+ end
+ if op == '//' then
+ local uri = guide.getUri(source)
+ local infer1 = vm.getInfer(source[1])
+ local infer2 = vm.getInfer(source[2])
+ if (infer1:hasType(uri, 'integer') or infer1:hasType(uri, 'number'))
+ and (infer2:hasType(uri, 'integer') or infer2:hasType(uri, 'number')) then
+ vm.setNode(source, vm.declareGlobal('type', 'integer'))
+ return
+ end
+ end
end
end)
: case '..'