Fix And and Or instructions behaviour
This commit is contained in:
parent
c170f0c0c6
commit
2e48fbde28
1 changed files with 6 additions and 2 deletions
|
|
@ -367,10 +367,14 @@ func (vm *VM) Next() bool {
|
|||
vm.stack.Push(!b)
|
||||
|
||||
case InstructionAnd:
|
||||
vm.stack.Push(vm.stack.Pop().(BoolValue) && vm.stack.Pop().(BoolValue))
|
||||
r := vm.stack.Pop().(BoolValue)
|
||||
l := vm.stack.Pop().(BoolValue)
|
||||
vm.stack.Push(l && r)
|
||||
|
||||
case InstructionOr:
|
||||
vm.stack.Push(vm.stack.Pop().(BoolValue) || vm.stack.Pop().(BoolValue))
|
||||
r := vm.stack.Pop().(BoolValue)
|
||||
l := vm.stack.Pop().(BoolValue)
|
||||
vm.stack.Push(r || l)
|
||||
|
||||
case InstructionLess:
|
||||
r := vm.stack.Pop().(NumberValue)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue