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

Method consider_decorator

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

Source from the content-addressed store, hash-verified

1195 }
1196
1197 fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) {
1198 if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") {
1199 return;
1200 }
1201 let mut target: Option<Node> = None;
1202 for i in 0..n.named_child_count() {
1203 let Some(child) = n.named_child(i) else { continue };
1204 if child.kind() == "call_expression" {
1205 target = child.child_by_field_name("function").or_else(|| child.named_child(0));
1206 if target.is_some() {
1207 break;
1208 }
1209 }
1210 if matches!(
1211 child.kind(),
1212 "identifier" | "member_expression" | "scoped_identifier" | "navigation_expression"
1213 | "user_type" | "type_identifier"
1214 ) {
1215 target = Some(child);
1216 break;
1217 }
1218 }
1219 let Some(target) = target else { return };
1220 let name = strip_generic_and_qualifier(self.text(target));
1221 if name.is_empty() {
1222 return;
1223 }
1224 self.push_ref_at(decorated_row, &name, edge_kind_index("decorates").unwrap(), n);
1225 }
1226
1227 // --- function-as-value refs (KOTLIN_SPEC, function-ref.ts:240) ------------------
1228

Callers 1

Calls 5

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

Tested by

no test coverage detected