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

Method visibility_of

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

812 /// parent's children decides (document order, not nearest-preceding —
813 /// bug-for-bug with the TS loop).
814 fn visibility_of(&self, node: Node) -> Option<u8> {
815 let parent = node.parent()?;
816 for i in 0..parent.child_count() {
817 let Some(child) = parent.child(i) else { continue };
818 if child.kind() == "access_specifier" {
819 let text = self.text(child);
820 if text.contains("public") {
821 return Some(1);
822 }
823 if text.contains("private") {
824 return Some(2);
825 }
826 if text.contains("protected") {
827 return Some(3);
828 }
829 }
830 }
831 None
832 }
833
834 /// cExtractor.isConst: any named `type_qualifier` child reading "const".
835 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