summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/global.lua4
-rw-r--r--script/vm/operator.lua18
2 files changed, 13 insertions, 9 deletions
diff --git a/script/vm/global.lua b/script/vm/global.lua
index c9bb4cc7..22235681 100644
--- a/script/vm/global.lua
+++ b/script/vm/global.lua
@@ -350,6 +350,10 @@ local compilerGlobalSwitch = util.switch()
or field.value.type == 'string' then
source._enums[#source._enums+1] = field.value[1]
end
+ if field.value.type == 'binary'
+ or field.value.type == 'unary' then
+ source._enums[#source._enums+1] = vm.getNumber(field.value)
+ end
::CONTINUE::
end
end
diff --git a/script/vm/operator.lua b/script/vm/operator.lua
index de2c3243..9dea01c1 100644
--- a/script/vm/operator.lua
+++ b/script/vm/operator.lua
@@ -231,11 +231,11 @@ vm.binarySwitch = util.switch()
local b = vm.getInteger(source[2])
local op = source.op.type
if a and b then
- local result = op.type == '<<' and a << b
- or op.type == '>>' and a >> b
- or op.type == '&' and a & b
- or op.type == '|' and a | b
- or op.type == '~' and a ~ b
+ local result = op == '<<' and a << b
+ or op == '>>' and a >> b
+ or op == '&' and a & b
+ or op == '|' and a | b
+ or op == '~' and a ~ b
vm.setNode(source, {
type = 'integer',
start = source.start,
@@ -351,10 +351,10 @@ vm.binarySwitch = util.switch()
local b = vm.getNumber(source[2])
if a and b then
local op = source.op.type
- local result = op.type == '>' and a > b
- or op.type == '<' and a < b
- or op.type == '>=' and a >= b
- or op.type == '<=' and a <= b
+ local result = op == '>' and a > b
+ or op == '<' and a < b
+ or op == '>=' and a >= b
+ or op == '<=' and a <= b
vm.setNode(source, {
type = 'boolean',
start = source.start,