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

Method consider_decorator

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

Source from the content-addressed store, hash-verified

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