Skip to main content

primitive_bridge_call

Function primitive_bridge_call 

Source
pub fn primitive_bridge_call<'a>(
    call_node: &'a AIRNode,
    callee: &'a AIRNode,
    args: &'a [AirArg],
) -> Option<(&'a AIRNode, &'a str, &'a [AirArg], &'a str)>
Expand description

Recognise a desugared primitive trait-bridge method call.

Building on desugared_self_call, this additionally requires that (a) the call_node carries the checker’s recv_kind = "Primitive:<Ty>" annotation and (b) the method is one of PRIMITIVE_BRIDGE_METHODS. Returns the receiver node, the method name, the remaining (non-self) arguments, and the primitive type name — everything a backend needs to lower the call to its intrinsic (x.cmp(&y) / x == y / x.to_string() in Rust, the ternary Ordering construction in JS/TS/Python/Go, …).

call_node is the full Call AIR node (it holds the annotation); callee and args are its callee/args fields, passed separately so a backend can call this from inside its NodeKind::Call { callee, args, .. } match arm.