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

Method consider_decorator

codegraph-kernel/src/swift.rs:1320–1348  ·  view source on GitHub ↗
(&mut self, n: Node<'t>, decorated_row: u32)

Source from the content-addressed store, hash-verified

1318 }
1319
1320 fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) {
1321 if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") {
1322 return;
1323 }
1324 let mut target: Option<Node> = None;
1325 for i in 0..n.named_child_count() {
1326 let Some(child) = n.named_child(i) else { continue };
1327 if child.kind() == "call_expression" {
1328 target = child.child_by_field_name("function").or_else(|| child.named_child(0));
1329 if target.is_some() {
1330 break;
1331 }
1332 }
1333 if matches!(
1334 child.kind(),
1335 "identifier" | "member_expression" | "scoped_identifier" | "navigation_expression"
1336 | "user_type" | "type_identifier"
1337 ) {
1338 target = Some(child);
1339 break;
1340 }
1341 }
1342 let Some(target) = target else { return };
1343 let name = strip_generic_and_qualifier(self.text(target));
1344 if name.is_empty() {
1345 return;
1346 }
1347 self.push_ref_at(decorated_row, &name, edge_kind_index("decorates").unwrap(), n);
1348 }
1349
1350 // --- function-as-value refs (SWIFT_SPEC, function-ref.ts:288) -------------------
1351

Callers 1

Calls 5

edge_kind_indexFunction · 0.85
textMethod · 0.65
unwrapMethod · 0.60
push_ref_atMethod · 0.45

Tested by

no test coverage detected