[bindings] Avoid guessing whether resolved type is a ref in blocks
authorMatt Corallo <git@bluematt.me>
Thu, 1 Oct 2020 22:42:33 +0000 (18:42 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 21 Oct 2020 18:50:22 +0000 (14:50 -0400)
commitbb4115effd4b8c7f5f597e8dea257347cdcddc51
tree9a10c443248c8ca221fa8456c7001f9b6b322464
parenta14e63e0b34eed7a6ed341e897ed1c2257dad13f
[bindings] Avoid guessing whether resolved type is a ref in blocks

In some cases, things which are a Rust Reference (ie slices), we
may still want to map them as a non-reference and need to put a
"mut " in front of the variable name in a function decl. This
worked fine by just checking for the slice case, except that we
are about to add support for type aliases, which no longer match
the naive case.

Instead, we can just have the types module print out the C type and
check if it begins with a '&' to figure out if it is a reference.
c-bindings-gen/src/blocks.rs