Conditional eval partway implemented

Need to change the AST representation to support compound statements I
think
This commit is contained in:
greg 2016-12-31 00:57:00 -08:00
parent 12fee6158c
commit 7f52b20d97

View File

@ -203,7 +203,18 @@ impl Evaluator {
(Call(name, args), None)
}
}
Conditional(box test, then_block, else_block) => unimplemented!(),
Conditional(box test, then_block, else_block) => {
if test.is_reducible() {
let (new_test, new_effect) = self.reduce_expr(test);
(Conditional(Box::new(new_test), then_block, else_block), new_effect)
} else {
if let Number(0.0) = test {
unimplemented!()
} else {
unimplemented!()
}
}
}
}
}