The name a non-member callee writes, past `(fn)`, `fn!`, `(fn as F)`, `await` and a tag's type arguments (`css `), or None for one that names nothing: a call, a function, a subscript, `(0, fn)`. A dotted chain keeps its text, `(a.b)()` → `a.b`. The node is where the name starts, which is where the reference sits. Mirrors tsJsCalleeName.
(&self, func: Node<'t>)
| 1916 | /// chain keeps its text, `(a.b)()` → `a.b`. The node is where the name |
| 1917 | /// starts, which is where the reference sits. Mirrors tsJsCalleeName. |
| 1918 | fn callee_name_of(&self, func: Node<'t>) -> Option<(String, Node<'t>)> { |
| 1919 | let mut cur = peel_receiver(func); |
| 1920 | while cur.kind() == "instantiation_expression" { |
| 1921 | let inner = cur.child_by_field_name("function").or_else(|| cur.named_child(0))?; |
| 1922 | cur = peel_receiver(inner); |
| 1923 | } |
| 1924 | match cur.kind() { |
| 1925 | "identifier" | "super" | "import" => Some((self.text(cur).to_string(), cur)), |
| 1926 | "member_expression" => { |
| 1927 | let chain: String = self.text(cur).chars().filter(|c| !c.is_whitespace()).collect(); |
| 1928 | util::dotted_chain().is_match(&chain).then_some((chain, cur)) |
| 1929 | } |
| 1930 | _ => None, |
| 1931 | } |
| 1932 | } |
| 1933 | |
| 1934 | // --- extractInstantiation ----------------------------------------------------------- |
| 1935 |
no test coverage detected