dartCtorInfo (dart.ts:61-70).
(&self, node: Node<'t>)
| 499 | |
| 500 | /// dartCtorInfo (dart.ts:61-70). |
| 501 | fn ctor_info(&self, node: Node<'t>) -> Option<(String, String)> { |
| 502 | let ctor = self.constructor_signature(node)?; |
| 503 | // The names before the parameters: a redirecting factory names its |
| 504 | // target after them (`factory Foo() = _Impl.named;`). |
| 505 | let mut cursor = ctor.walk(); |
| 506 | let ids: Vec<Node<'t>> = ctor |
| 507 | .named_children(&mut cursor) |
| 508 | .take_while(|c| c.kind() != "formal_parameter_list") |
| 509 | .filter(|c| c.kind() == "identifier") |
| 510 | .collect(); |
| 511 | let class_name = self.enclosing_type_name(node)?; |
| 512 | let first = ids.first()?; |
| 513 | if self.text(*first) != class_name { |
| 514 | return None; // misparsed method, not a ctor |
| 515 | } |
| 516 | let ctor_name = ids.get(1).map(|n| self.text(*n)).unwrap_or(class_name); |
| 517 | Some((class_name.to_string(), ctor_name.to_string())) |
| 518 | } |
| 519 | |
| 520 | /// extractDartReturnType (dart.ts:80-92). |
| 521 | fn return_type_of(&self, node: Node<'t>) -> Option<String> { |
no test coverage detected