summaryrefslogtreecommitdiff
path: root/libbindgen/src/codegen/helpers.rs
diff options
context:
space:
mode:
authorXidorn Quan <me@upsuper.org>2016-11-17 11:43:10 +1100
committerXidorn Quan <me@upsuper.org>2016-11-17 12:42:28 +1100
commit47cb4e34df94480780ea2dc4d7070eb306f1193b (patch)
tree272cd673fca2f27f413b051eba654866b474114d /libbindgen/src/codegen/helpers.rs
parentea1d6449ec1b0fde9eef2d3f2fe9846c1ac336ff (diff)
Generate bool value for bool constants
This fixes #272.
Diffstat (limited to 'libbindgen/src/codegen/helpers.rs')
-rw-r--r--libbindgen/src/codegen/helpers.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/libbindgen/src/codegen/helpers.rs b/libbindgen/src/codegen/helpers.rs
index 8c3d3cea..7284ab80 100644
--- a/libbindgen/src/codegen/helpers.rs
+++ b/libbindgen/src/codegen/helpers.rs
@@ -133,6 +133,10 @@ pub mod ast_ty {
}
}
+ pub fn bool_expr(val: bool) -> P<ast::Expr> {
+ aster::AstBuilder::new().expr().bool(val)
+ }
+
pub fn byte_array_expr(bytes: &[u8]) -> P<ast::Expr> {
let mut vec = Vec::with_capacity(bytes.len() + 1);
for byte in bytes {