Skip to main content

desugared_list_functional_method

Function desugared_list_functional_method 

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

Recognise a desugared List functional (closure-taking) method call.

The functional sibling of desugared_list_method: same desugared shape (Call { callee: FieldAccess(recv, method), args: [recv, closure, …] }), same recv_kind-gating (accepts a recv_kind = "List" stamp or an absent stamp, rejects any other stamp so a same-named user-record method or a Map/Set method is not shadowed — those run before this recogniser via their own recv_kind), but requires the method to be one of FUNCTIONAL_LIST_METHODS. Returns the receiver, the validated method name, and the remaining (non-self) arguments (the closure plus, for fold, the initial accumulator).

Each backend wires this into its Call arm alongside desugared_list_method and lowers it to the target’s native iteration idiom with the closure passed once and correctly (no duplicated receiver).