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