forked from M-Labs/nac3
1
0
Fork 0

support boolean constants

This commit is contained in:
Sebastien Bourdeauducq 2020-03-30 18:23:20 +08:00
parent aecf24c857
commit 43bc7392ff
1 changed files with 2 additions and 0 deletions

View File

@ -197,6 +197,8 @@ impl<'ctx> CodeGen<'ctx> {
self.set_source_location(expression.location);
match &expression.node {
ast::ExpressionType::True => Ok(self.context.bool_type().const_int(1, false).into()),
ast::ExpressionType::False => Ok(self.context.bool_type().const_int(0, false).into()),
ast::ExpressionType::Number { value: ast::Number::Integer { value } } => {
let mut bits = value.bits();
if value.sign() == num_bigint::Sign::Minus {