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

Method extract_static_member_ref

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

Source from the content-addressed store, hash-verified

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

Callers 1

visit_bodyMethod · 0.45

Calls 4

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

Tested by

no test coverage detected