MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / ctor_info

Method ctor_info

codegraph-kernel/src/dart.rs:411–425  ·  view source on GitHub ↗

dartCtorInfo (dart.ts:61-70).

(&self, node: Node<'t>)

Source from the content-addressed store, hash-verified

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> {

Callers 3

return_type_ofMethod · 0.80
is_unnamed_ctorMethod · 0.80
extract_nameMethod · 0.80

Calls 5

constructor_signatureMethod · 0.80
enclosing_type_nameMethod · 0.80
getMethod · 0.65
collectMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected