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

Method consider_decorator

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

Source from the content-addressed store, hash-verified

1273 }
1274
1275 fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) {
1276 if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") {
1277 return;
1278 }
1279 let mut target: Option<Node> = None;
1280 for child in n.named_children(&mut n.walk()) {
1281 if child.kind() == "call_expression" {
1282 target = child.child_by_field_name("function").or_else(|| child.named_child(0));
1283 if target.is_some() {
1284 break;
1285 }
1286 }
1287 if matches!(
1288 child.kind(),
1289 "identifier" | "member_expression" | "scoped_identifier" | "navigation_expression"
1290 | "user_type" | "type_identifier"
1291 ) {
1292 target = Some(child);
1293 break;
1294 }
1295 }
1296 let Some(target) = target else { return };
1297 let name = strip_generic_and_qualifier(self.text(target));
1298 if name.is_empty() {
1299 return;
1300 }
1301 self.push_ref_at(decorated_row, &name, edge_kind_index("decorates").unwrap(), n);
1302 }
1303
1304 // --- function-as-value refs (SWIFT_SPEC, function-ref.ts:288) -------------------
1305

Callers 1

Calls 6

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

Tested by

no test coverage detected