support boolean constants

This commit is contained in:
Sebastien Bourdeauducq 2020-03-30 18:23:20 +08:00
parent aecf24c857
commit 43bc7392ff

View File

@ -197,6 +197,8 @@ impl<'ctx> CodeGen<'ctx> {
self.set_source_location(expression.location); self.set_source_location(expression.location);
match &expression.node { 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 } } => { ast::ExpressionType::Number { value: ast::Number::Integer { value } } => {
let mut bits = value.bits(); let mut bits = value.bits();
if value.sign() == num_bigint::Sign::Minus { if value.sign() == num_bigint::Sign::Minus {