Handle short circuit boolean operators correctly.

This commit is contained in:
Russ Olsen 2020-05-22 15:06:58 -04:00
parent 6c67d2350f
commit 4c03ea5388

View file

@ -56,11 +56,15 @@ def div(forth):
@word('and') @word('and')
def w_and(forth): def w_and(forth):
forth.stack.push(forth.stack.pop() and forth.stack.pop()) a = forth.stack.pop()
b = forth.stack.pop()
forth.stack.push(a and b)
@word('or') @word('or')
def w_or(forth): def w_or(forth):
forth.stack.push(forth.stack.pop() or forth.stack.pop()) a = forth.stack.pop()
b = forth.stack.pop()
forth.stack.push(a or b)
@word('not') @word('not')
def w_not(forth): def w_not(forth):