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

Method consider_decorator

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

Source from the content-addressed store, hash-verified

1055 }
1056
1057 fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) {
1058 if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") {
1059 return;
1060 }
1061 let mut target: Option<Node> = None;
1062 for i in 0..n.named_child_count() {
1063 let Some(child) = n.named_child(i) else { continue };
1064 if child.kind() == "call_expression" {
1065 target = child.child_by_field_name("function").or_else(|| child.named_child(0));
1066 if target.is_some() {
1067 break;
1068 }
1069 }
1070 if matches!(
1071 child.kind(),
1072 "identifier" | "member_expression" | "scoped_identifier" | "navigation_expression"
1073 | "user_type" | "type_identifier"
1074 ) {
1075 target = Some(child);
1076 break;
1077 }
1078 }
1079 let Some(target) = target else { return };
1080 let name = strip_generic_and_qualifier(self.text(target));
1081 if name.is_empty() {
1082 return;
1083 }
1084 self.push_ref_at(decorated_row, &name, edge_kind_index("decorates").unwrap(), n);
1085 }
1086
1087 /// extractTypeAnnotations — Java's returnField is `type`.
1088 fn extract_type_annotations(&mut self, node: Node<'t>, from_row: u32) {

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