dartCtorInfo (dart.ts:61-70).
(&self, node: Node<'t>)
| 409 | |
| 410 | /// dartCtorInfo (dart.ts:61-70). |
| 411 | fn ctor_info(&self, node: Node<'t>) -> Option<(String, String)> { |
| 412 | let ctor = self.constructor_signature(node)?; |
| 413 | let mut cursor = ctor.walk(); |
| 414 | let ids: Vec<Node<'t>> = ctor |
| 415 | .named_children(&mut cursor) |
| 416 | .filter(|c| c.kind() == "identifier") |
| 417 | .collect(); |
| 418 | let class_name = self.enclosing_type_name(node)?; |
| 419 | let first = ids.first()?; |
| 420 | if self.text(*first) != class_name { |
| 421 | return None; // misparsed method, not a ctor |
| 422 | } |
| 423 | let ctor_name = ids.get(1).map(|n| self.text(*n)).unwrap_or(class_name); |
| 424 | Some((class_name.to_string(), ctor_name.to_string())) |
| 425 | } |
| 426 | |
| 427 | /// extractDartReturnType (dart.ts:80-92). |
| 428 | fn return_type_of(&self, node: Node<'t>) -> Option<String> { |
no test coverage detected