|
@@ -174,13 +174,20 @@ class AnalysisState(object):
|
|
|
("RD", [instruction_id, "then"]),
|
|
|
("RD", [instruction_id, "else"])]
|
|
|
|
|
|
- gen = self.analyze_all([cond, true, false])
|
|
|
+ gen = self.analyze_all(
|
|
|
+ [cond, true]
|
|
|
+ if false is None
|
|
|
+ else [cond, true, false])
|
|
|
try:
|
|
|
inp = None
|
|
|
while True:
|
|
|
inp = yield gen.send(inp)
|
|
|
- except primitive_functions.PrimitiveFinished as e:
|
|
|
- cond_r, true_r, false_r = e.result
|
|
|
+ except primitive_functions.PrimitiveFinished as ex:
|
|
|
+ if false is None:
|
|
|
+ cond_r, true_r = ex.result
|
|
|
+ false_r = tree_ir.EmptyInstruction()
|
|
|
+ else:
|
|
|
+ cond_r, true_r, false_r = ex.result
|
|
|
raise primitive_functions.PrimitiveFinished(
|
|
|
tree_ir.SelectInstruction(
|
|
|
tree_ir.ReadValueInstruction(cond_r),
|