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

Method consider_decorator

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

Source from the content-addressed store, hash-verified

1141 }
1142
1143 fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) {
1144 if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") {
1145 return;
1146 }
1147 let mut target: Option<Node> = None;
1148 for i in 0..n.named_child_count() {
1149 let Some(child) = n.named_child(i) else { continue };
1150 if child.kind() == "call_expression" {
1151 target = child.child_by_field_name("function").or_else(|| child.named_child(0));
1152 if target.is_some() {
1153 break;
1154 }
1155 }
1156 if matches!(
1157 child.kind(),
1158 "identifier" | "member_expression" | "scoped_identifier" | "navigation_expression"
1159 | "user_type" | "type_identifier"
1160 ) {
1161 target = Some(child);
1162 break;
1163 }
1164 }
1165 let Some(target) = target else { return };
1166 let name = strip_generic_and_qualifier(self.text(target));
1167 if name.is_empty() {
1168 return;
1169 }
1170 self.push_ref_at(decorated_row, &name, edge_kind_index("decorates").unwrap(), n);
1171 }
1172
1173 /// extractTypeAnnotations — Java's returnField is `type`.
1174 fn extract_type_annotations(&mut self, node: Node<'t>, from_row: u32) {

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