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>)
| 2303 | /// chain keeps its text, `(a.b)()` → `a.b`. The node is where the name |
| 2304 | /// starts, which is where the reference sits. Mirrors tsJsCalleeName. |
| 2305 | fn callee_name_of(&self, func: Node<'t>) -> Option<(String, Node<'t>)> { |
| 2306 | let mut cur = peel_receiver(func); |
| 2307 | while cur.kind() == "instantiation_expression" { |
| 2308 | let inner = cur.child_by_field_name("function").or_else(|| cur.named_child(0))?; |
| 2309 | cur = peel_receiver(inner); |
| 2310 | } |
| 2311 | match cur.kind() { |
| 2312 | "identifier" | "super" | "import" => Some((self.text(cur).to_string(), cur)), |
| 2313 | "member_expression" => { |
| 2314 | let chain: String = self.text(cur).chars().filter(|c| !c.is_whitespace()).collect(); |
| 2315 | util::dotted_chain().is_match(&chain).then_some((chain, cur)) |
| 2316 | } |
| 2317 | _ => None, |
| 2318 | } |
| 2319 | } |
| 2320 | |
| 2321 | // --- extractInstantiation ----------------------------------------------------------- |
| 2322 |
no test coverage detected