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

Method extract_instantiation

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

Source from the content-addressed store, hash-verified

1303 // --- extractInstantiation (:4610, generic tail) -----------------------
1304
1305 fn extract_instantiation(&mut self, node: Node<'t>) {
1306 if self.stack.is_empty() {
1307 return;
1308 }
1309 let from_row = self.top_row();
1310 let ctor = node
1311 .child_by_field_name("constructor")
1312 .or_else(|| node.child_by_field_name("type"))
1313 .or_else(|| node.child_by_field_name("name"))
1314 .or_else(|| node.named_child(0));
1315 let Some(ctor) = ctor else { return };
1316 let mut class_name = self.text(ctor).to_string();
1317 if let Some(lt) = class_name.find('<') {
1318 if lt > 0 {
1319 class_name.truncate(lt);
1320 }
1321 }
1322 let last_dot = class_name.rfind('.').map(|i| i as i64).unwrap_or(-1);
1323 let last_colons = class_name.rfind("::").map(|i| (i + 1) as i64).unwrap_or(-1);
1324 let last = last_dot.max(last_colons);
1325 if last >= 0 {
1326 class_name = class_name[(last as usize + 1)..].to_string();
1327 class_name = class_name.trim_start_matches([':', '.']).to_string();
1328 }
1329 let class_name = class_name.trim().to_string();
1330 if class_name.is_empty() {
1331 return;
1332 }
1333 self.push_ref_at(from_row, &class_name, "instantiates", node);
1334 }
1335
1336 // --- extractBareCall (dart.ts:305-379) --------------------------------
1337

Callers 2

visitMethod · 0.45
visit_bodyMethod · 0.45

Calls 4

mapMethod · 0.80
textMethod · 0.65
top_rowMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected