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

Method visibility_of

codegraph-kernel/src/ccpp/mod.rs:993–1011  ·  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

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