Skip to main content

desugared_result_method

Function desugared_result_method 

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

Recognise a desugared Result[T, E] built-in method call.

The Result counterpart of desugared_optional_method: requires the recv_kind = "Result" annotation and a method in RESULT_METHODS. Returns the receiver node, the method name, and the remaining (non-self) arguments. The recv_kind disambiguation is what lets a backend distinguish r.unwrap_or(d) on a Result (test _tag === "Ok") from the same call on an Optional (test _tag === "Some").