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

Method consider_decorator

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

Source from the content-addressed store, hash-verified

1100 }
1101
1102 fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) {
1103 if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") {
1104 return;
1105 }
1106 let mut target: Option<Node> = None;
1107 for child in n.named_children(&mut n.walk()) {
1108 if child.kind() == "call_expression" {
1109 target = child.child_by_field_name("function").or_else(|| child.named_child(0));
1110 if target.is_some() {
1111 break;
1112 }
1113 }
1114 if matches!(
1115 child.kind(),
1116 "identifier" | "member_expression" | "scoped_identifier" | "navigation_expression"
1117 | "user_type" | "type_identifier"
1118 ) {
1119 target = Some(child);
1120 break;
1121 }
1122 }
1123 let Some(target) = target else { return };
1124 let name = strip_generic_and_qualifier(self.text(target));
1125 if name.is_empty() {
1126 return;
1127 }
1128 self.push_ref_at(decorated_row, &name, edge_kind_index("decorates").unwrap(), n);
1129 }
1130
1131 /// extractTypeAnnotations — Java's returnField is `type`.
1132 fn extract_type_annotations(&mut self, node: Node<'t>, from_row: u32) {

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