Skip to main content

desugared_list_inplace_mutator

Function desugared_list_inplace_mutator 

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

Recognise a desugared DQ30 in-place List mutator call (pop/remove_at/insert/reverse/set).

The DQ30 sibling of desugared_list_mutating_method: same desugared shape (Call { callee: FieldAccess(recv, method), args: [recv, ...rest] }), but the method must be one of INPLACE_LIST_MUTATORS — and set additionally requires the explicit recv_kind = "List" stamp (never the absent-stamp fall-through), because set(k, v) is also a live Map method and an unstamped receiver must not be claimed by the List lowering. The other four names are List-only today, so they keep the DQ18 None | "List" gating (the checker leaves an unresolved-inference receiver unstamped).

Returns the receiver, the validated method name, and the remaining (non-self) arguments. The ownership pass guarantees the receiver is a mut lvalue (E5004), so each backend may mutate the receiver place in its lowering (JS/TS/Python mutate the reference; Go reassigns through a pointer where the length changes; Rust borrows &mut natively).