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

Method extract_static_member_ref

codegraph-kernel/src/scala.rs:955–1000  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

953 // --- extractStaticMemberRef (:4750-4808) ------------------------------
954
955 fn extract_static_member_ref(&mut self, node: Node<'t>) {
956 if self.stack.is_empty() {
957 return;
958 }
959 let owner_row = self.top_row();
960 // MEMBER_ACCESS_TYPES — only field_expression occurs in scala trees.
961 if !matches!(
962 node.kind(),
963 "field_access" | "member_access_expression" | "navigation_expression"
964 | "field_expression" | "class_constant_access_expression"
965 | "scoped_property_access_expression" | "qualified_identifier"
966 ) {
967 return;
968 }
969 // Callee-of-call skip: `Type.method()`'s callee access is already a
970 // calls ref.
971 if let Some(parent) = node.parent() {
972 if parent.kind() == "call_expression" {
973 let callee = parent
974 .child_by_field_name("function")
975 .or_else(|| parent.child_by_field_name("method"))
976 .or_else(|| parent.named_child(0));
977 if let Some(callee) = callee {
978 if callee.start_byte() == node.start_byte() {
979 return;
980 }
981 }
982 }
983 }
984 let recv = node
985 .child_by_field_name("object")
986 .or_else(|| node.child_by_field_name("expression"))
987 .or_else(|| node.child_by_field_name("scope"))
988 .or_else(|| node.named_child(0));
989 let Some(recv) = recv else { return };
990 if matches!(
991 recv.kind(),
992 "identifier" | "type_identifier" | "simple_identifier" | "name" | "scoped_type_identifier"
993 ) {
994 let text = self.text(recv);
995 if cap_ident_re().is_match(text) {
996 let text = text.to_string();
997 self.push_ref_at(owner_row, &text, "references", recv);
998 }
999 }
1000 }
1001
1002 // --- extractDecoratorsFor (:4897-5024) --------------------------------
1003

Callers 1

visit_bodyMethod · 0.45

Calls 4

cap_ident_reFunction · 0.70
textMethod · 0.65
top_rowMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected