summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-03-13 19:21:40 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-03-13 19:21:40 +0800
commit6ef1608d857e0179c4db7a14037df84dbef676c8 (patch)
treeb007e893750d513427db64f4eb04ece13c6ce787 /script
parent671d9526cbfa83c01e74aa3405f1d32b647822d7 (diff)
downloadlua-language-server-6ef1608d857e0179c4db7a14037df84dbef676c8.zip
look into unions for operators
fix #1996
Diffstat (limited to 'script')
-rw-r--r--script/vm/operator.lua21
1 files changed, 14 insertions, 7 deletions
diff --git a/script/vm/operator.lua b/script/vm/operator.lua
index 48e29304..9c68e648 100644
--- a/script/vm/operator.lua
+++ b/script/vm/operator.lua
@@ -73,15 +73,22 @@ local function checkOperators(operators, op, value, result)
local valueNode = vm.compileNode(value)
local expNode = vm.compileNode(operator.exp)
local uri = guide.getUri(operator)
- if not vm.isSubType(uri, valueNode, expNode) then
- goto CONTINUE
+ for vo in valueNode:eachObject() do
+ if vm.isSubType(uri, vo, expNode) then
+ if not result then
+ result = vm.createNode()
+ end
+ result:merge(vm.compileNode(operator.extends))
+ return result
+ end
end
+ else
+ if not result then
+ result = vm.createNode()
+ end
+ result:merge(vm.compileNode(operator.extends))
+ return result
end
- if not result then
- result = vm.createNode()
- end
- result:merge(vm.compileNode(operator.extends))
- break
::CONTINUE::
end
return result