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

Method visibility_of

codegraph-kernel/src/ccpp/mod.rs:991–1009  ·  view source on GitHub ↗

cppExtractor.getVisibility: the FIRST access_specifier among the parent's children decides (document order, not nearest-preceding — bug-for-bug with the TS loop).

(&self, node: Node)

Source from the content-addressed store, hash-verified

989 /// parent's children decides (document order, not nearest-preceding —
990 /// bug-for-bug with the TS loop).
991 fn visibility_of(&self, node: Node) -> Option<u8> {
992 let parent = node.parent()?;
993 for i in 0..parent.child_count() {
994 let Some(child) = parent.child(i) else { continue };
995 if child.kind() == "access_specifier" {
996 let text = self.text(child);
997 if text.contains("public") {
998 return Some(1);
999 }
1000 if text.contains("private") {
1001 return Some(2);
1002 }
1003 if text.contains("protected") {
1004 return Some(3);
1005 }
1006 }
1007 }
1008 None
1009 }
1010
1011 /// cExtractor.isConst: any named `type_qualifier` child reading "const".
1012 fn is_const_declaration(&self, node: Node) -> bool {

Callers 5

extract_functionMethod · 0.45
extract_methodMethod · 0.45
extract_classMethod · 0.45
extract_aggregateMethod · 0.45
extract_enumMethod · 0.45

Calls 1

textMethod · 0.65

Tested by

no test coverage detected