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

Method extract_static_member_ref

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

Source from the content-addressed store, hash-verified

972 // --- extractStaticMemberRef (:4750-4808) ------------------------------
973
974 fn extract_static_member_ref(&mut self, node: Node<'t>) {
975 if self.stack.is_empty() {
976 return;
977 }
978 let owner_row = self.top_row();
979 // MEMBER_ACCESS_TYPES — only field_expression occurs in scala trees.
980 if !matches!(
981 node.kind(),
982 "field_access" | "member_access_expression" | "navigation_expression"
983 | "field_expression" | "class_constant_access_expression"
984 | "scoped_property_access_expression" | "qualified_identifier"
985 ) {
986 return;
987 }
988 // Callee-of-call skip: `Type.method()`'s callee access is already a
989 // calls ref.
990 if let Some(parent) = node.parent() {
991 if parent.kind() == "call_expression" {
992 let callee = parent
993 .child_by_field_name("function")
994 .or_else(|| parent.child_by_field_name("method"))
995 .or_else(|| parent.named_child(0));
996 if let Some(callee) = callee {
997 if callee.start_byte() == node.start_byte() {
998 return;
999 }
1000 }
1001 }
1002 }
1003 let recv = node
1004 .child_by_field_name("object")
1005 .or_else(|| node.child_by_field_name("expression"))
1006 .or_else(|| node.child_by_field_name("scope"))
1007 .or_else(|| node.named_child(0));
1008 let Some(recv) = recv else { return };
1009 if matches!(
1010 recv.kind(),
1011 "identifier" | "type_identifier" | "simple_identifier" | "name" | "scoped_type_identifier"
1012 ) {
1013 let text = self.text(recv);
1014 if cap_ident_re().is_match(text) {
1015 let text = text.to_string();
1016 self.push_ref_at(owner_row, &text, "references", recv);
1017 }
1018 }
1019 }
1020
1021 // --- extractDecoratorsFor (:4897-5024) --------------------------------
1022

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