Skip to main content

desugared_self_call

Function desugared_self_call 

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

Recognise a desugared instance method call.

The AIR lowerer rewrites recv.method(args) into Call { callee: FieldAccess(recv, method), args: [recv, ...args] }, cloning the receiver into both the field-access object and the leading argument (so they share a NodeId). This helper detects that shape — callee is a FieldAccess whose object is identical to the first argument — and returns the receiver, the method name, and the remaining (non-self) arguments. Targets with native method receivers (Rust, Go, Python) use this to emit recv.method(rest) instead of double-passing the receiver. Associated calls (Type.method(...)) prepend no self and are not matched here.