methodCallName.
(base: &MExpr, method: &str)
| 1956 | |
| 1957 | /// methodCallName. |
| 1958 | fn macro_method_call_name(base: &MExpr, method: &str) -> Option<String> { |
| 1959 | match base { |
| 1960 | MExpr::Lit => return None, |
| 1961 | MExpr::Name(n) => { |
| 1962 | return Some(if n == "this" || n == "cls" || n == "super" { method.to_string() } else { format!("{n}.{method}") }); |
| 1963 | } |
| 1964 | MExpr::SelfE => return Some(format!("self.{method}")), |
| 1965 | MExpr::Field(b, n) => { |
| 1966 | if matches!(**b, MExpr::SelfE) && is_rust_ident(n) { |
| 1967 | return Some(format!("self.{n}.{method}")); |
| 1968 | } |
| 1969 | } |
| 1970 | MExpr::Call(c) => { |
| 1971 | if let MExpr::Path(t) = &**c { |
| 1972 | return Some(format!("{t}().{method}")); |
| 1973 | } |
| 1974 | } |
| 1975 | MExpr::Method(..) => {} |
| 1976 | _ => return Some(method.to_string()), |
| 1977 | } |
| 1978 | Some(match macro_receiver_chain(base) { |
| 1979 | Some(chain) => format!("{chain}.{method}"), |
| 1980 | None => method.to_string(), |
| 1981 | }) |
| 1982 | } |
| 1983 | |
| 1984 | /// rustMacroArgRefs: none unless `mac` is one of RUST_EXPRESSION_MACROS, or |
| 1985 | /// one of `declared`, the file's own, written bare or through `crate::` or |
no test coverage detected