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

Method extract_static_member_ref

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

Source from the content-addressed store, hash-verified

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

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