1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Small pure helpers that re-derive Go binding-backend signature decisions from the same
//! public IR facts the backend itself reads, so `snippet.rs`'s docs-snippet rendering agrees
//! with the generated bindings instead of re-asserting an independent copy of the logic.
use crate;
use HashSet;
/// Unwraps a (possibly `Optional`-wrapped) `TypeRef::Named` down to its type name.
///
/// Used to match a function parameter's IR type against the configured `options_type`
/// name so the pointer-vs-value and arity decisions below can be derived from the
/// same signature the Go binding backend generated from, instead of re-asserting it
/// independently. ~keep
pub
/// Mirrors `backends::go::gen_bindings::functions::gen_function_wrapper`'s pointer-vs-value
/// decision for a non-bridge parameter: the Go binding backend emits `*T` when the IR
/// parameter is `optional`, or when its `Named` type is opaque — value `T` otherwise. Both
/// this function and the binding backend read the same `ParamDef`/`TypeDef.is_opaque`
/// facts; this is a re-derivation of the same public inputs; it is not a copy of any
/// gen_bindings-private logic. ~keep
pub
/// Mirrors `gen_bindings::functions::is_bridge_param`'s two membership checks (by
/// parameter name, then by `Named` type alias) using the same `TraitBridgeConfig` facts
/// the binding backend reads — the params those checks match are real Rust function
/// parameters that the Go binding backend strips from its emitted signature (replaced by
/// a `nil` argument at the FFI call site), so they must not be counted toward the
/// Go-visible arity used by the `extra_args` clamp below. ~keep
pub