methodCallName.
(base: &MExpr, method: &str)
| 1929 | |
| 1930 | /// methodCallName. |
| 1931 | fn macro_method_call_name(base: &MExpr, method: &str) -> Option<String> { |
| 1932 | match base { |
| 1933 | MExpr::Lit => return None, |
| 1934 | MExpr::Name(n) => { |
| 1935 | return Some(if n == "this" || n == "cls" || n == "super" { method.to_string() } else { format!("{n}.{method}") }); |
| 1936 | } |
| 1937 | MExpr::SelfE => return Some(format!("self.{method}")), |
| 1938 | MExpr::Field(b, n) => { |
| 1939 | if matches!(**b, MExpr::SelfE) && is_rust_ident(n) { |
| 1940 | return Some(format!("self.{n}.{method}")); |
| 1941 | } |
| 1942 | } |
| 1943 | MExpr::Call(c) => { |
| 1944 | if let MExpr::Path(t) = &**c { |
| 1945 | return Some(format!("{t}().{method}")); |
| 1946 | } |
| 1947 | } |
| 1948 | MExpr::Method(..) => {} |
| 1949 | _ => return Some(method.to_string()), |
| 1950 | } |
| 1951 | Some(match macro_receiver_chain(base) { |
| 1952 | Some(chain) => format!("{chain}.{method}"), |
| 1953 | None => method.to_string(), |
| 1954 | }) |
| 1955 | } |
| 1956 | |
| 1957 | /// rustMacroArgRefs: none unless `mac` is one of RUST_EXPRESSION_MACROS. |
| 1958 | fn rust_macro_arg_refs<'t>(mac: Node<'t>, src: &'t str) -> Vec<MacroRef<'t>> { |
no test coverage detected