getSignature (dart.ts:189-208).
(&self, node: Node<'t>)
| 548 | |
| 549 | /// getSignature (dart.ts:189-208). |
| 550 | fn signature_of(&self, node: Node<'t>) -> Option<String> { |
| 551 | let sig = self.inner_signature(node); |
| 552 | let mut c1 = sig.walk(); |
| 553 | let params = sig |
| 554 | .named_children(&mut c1) |
| 555 | .find(|c| c.kind() == "formal_parameter_list"); |
| 556 | // A constructor has no return type: the type a redirecting factory |
| 557 | // names is its target (`= _Impl`). |
| 558 | let mut c2 = sig.walk(); |
| 559 | let ret = if is_bodiless_ctor(sig.kind()) { |
| 560 | None |
| 561 | } else { |
| 562 | sig.named_children(&mut c2) |
| 563 | .find(|c| matches!(c.kind(), "type_identifier" | "void_type")) |
| 564 | }; |
| 565 | if params.is_none() && ret.is_none() { |
| 566 | return None; |
| 567 | } |
| 568 | let mut result = String::new(); |
| 569 | if let Some(r) = ret { |
| 570 | result.push_str(self.text(r)); |
| 571 | result.push(' '); |
| 572 | } |
| 573 | if let Some(p) = params { |
| 574 | result.push_str(self.text(p)); |
| 575 | } |
| 576 | let trimmed = result.trim(); |
| 577 | if trimmed.is_empty() { |
| 578 | None |
| 579 | } else { |
| 580 | Some(trimmed.to_string()) |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | /// getVisibility (dart.ts:209-222) — `_` prefix = private; every |
| 585 | /// constructor is public (the unwrap misses ctor signatures / the name |
no test coverage detected