Skip to main content

desugared_map_method

Function desugared_map_method 

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

Recognise a desugared Map[K, V] built-in method call.

Building on desugared_self_call, this additionally requires that (a) the call_node carries the checker’s recv_kind = "Map" annotation and (b) the method is one of MAP_METHODS. Returns the receiver node, the method name, and the remaining (non-self) arguments — everything a backend needs to lower the call on the native map representation (new Map/dict/HashMap/ map[K]V). Each backend wires this into its Call arm before desugared_list_method so a Map receiver’s get/len/contains_key no longer hits the List path.

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, .. } arm.