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

Method extract_instantiation

codegraph-kernel/src/dart.rs:903–932  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

901 // --- extractInstantiation (:4610, generic tail) -----------------------
902
903 fn extract_instantiation(&mut self, node: Node<'t>) {
904 if self.stack.is_empty() {
905 return;
906 }
907 let from_row = self.top_row();
908 let ctor = node
909 .child_by_field_name("constructor")
910 .or_else(|| node.child_by_field_name("type"))
911 .or_else(|| node.child_by_field_name("name"))
912 .or_else(|| node.named_child(0));
913 let Some(ctor) = ctor else { return };
914 let mut class_name = self.text(ctor).to_string();
915 if let Some(lt) = class_name.find('<') {
916 if lt > 0 {
917 class_name.truncate(lt);
918 }
919 }
920 let last_dot = class_name.rfind('.').map(|i| i as i64).unwrap_or(-1);
921 let last_colons = class_name.rfind("::").map(|i| (i + 1) as i64).unwrap_or(-1);
922 let last = last_dot.max(last_colons);
923 if last >= 0 {
924 class_name = class_name[(last as usize + 1)..].to_string();
925 class_name = class_name.trim_start_matches([':', '.']).to_string();
926 }
927 let class_name = class_name.trim().to_string();
928 if class_name.is_empty() {
929 return;
930 }
931 self.push_ref_at(from_row, &class_name, "instantiates", node);
932 }
933
934 // --- extractBareCall (dart.ts:305-379) --------------------------------
935

Callers 2

visitMethod · 0.45
visit_bodyMethod · 0.45

Calls 3

top_rowMethod · 0.45
textMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected