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

Method consider_decorator

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

Source from the content-addressed store, hash-verified

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

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