summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/compiler.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 0cbe2b7a..acb39432 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1786,6 +1786,36 @@ local compilerSwitch = util.switch()
return
end
end
+ if source.op.type == '>'
+ or source.op.type == '<'
+ or source.op.type == '>='
+ or source.op.type == '<=' then
+ local a = vm.getNumber(source[1])
+ local b = vm.getNumber(source[2])
+ if a and b then
+ local result
+ if source.op.type == '>' then
+ result = a > b
+ elseif source.op.type == '<' then
+ result = a < b
+ elseif source.op.type == '>=' then
+ result = a >= b
+ elseif source.op.type == '<=' then
+ result = a <= b
+ end
+ vm.setNode(source, {
+ type = 'boolean',
+ start = source.start,
+ finish = source.finish,
+ parent = source,
+ [1] = result,
+ })
+ return
+ else
+ vm.setNode(source, vm.declareGlobal('type', 'boolean'))
+ return
+ end
+ end
end)
---@param source vm.object