Commit 37eea7a5 authored by Stefan Behnel's avatar Stefan Behnel

make overly complicated code logic in boolean and/or handling code understandable again

parent 24322dc3
...@@ -10045,20 +10045,19 @@ class BoolBinopResultNode(ExprNode): ...@@ -10045,20 +10045,19 @@ class BoolBinopResultNode(ExprNode):
code.funcstate.release_temp(test_result) code.funcstate.release_temp(test_result)
self.arg.generate_disposal_code(code) self.arg.generate_disposal_code(code)
if or_label: if or_label and or_label != fall_through:
# value is false => short-circuit to next 'or' # value is false => short-circuit to next 'or'
if or_label != fall_through: code.put_goto(or_label)
code.put_goto(or_label) if and_label and and_label != fall_through:
code.putln("} else {")
if and_label:
# value is true => go to next 'and' # value is true => go to next 'and'
if and_label != fall_through: if or_label:
code.put_goto(and_label)
if not or_label:
code.putln("} else {") code.putln("} else {")
code.put_goto(and_label)
if not and_label or not or_label: if not and_label or not or_label:
# if no next 'and' or 'or', we provide the result # if no next 'and' or 'or', we provide the result
if and_label or or_label:
code.putln("} else {")
self.value.generate_evaluation_code(code) self.value.generate_evaluation_code(code)
self.value.make_owned_reference(code) self.value.make_owned_reference(code)
code.putln("%s = %s;" % (final_result_temp, self.value.result())) code.putln("%s = %s;" % (final_result_temp, self.value.result()))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment